From 7fd3fae6b959eb18bada1799dfd3caa171c217a6 Mon Sep 17 00:00:00 2001 From: Thomas Ardal Date: Tue, 28 May 2024 10:11:20 +0200 Subject: [PATCH] SonarLint fixes in test --- .../Elmah.Io.AspNetCore.Serilog.Test.csproj | 1 + .../ElmahIoSerilogMiddlewareTest.cs | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/Elmah.Io.AspNetCore.Serilog.Test/Elmah.Io.AspNetCore.Serilog.Test.csproj b/test/Elmah.Io.AspNetCore.Serilog.Test/Elmah.Io.AspNetCore.Serilog.Test.csproj index e6e0e0a..c227fb6 100644 --- a/test/Elmah.Io.AspNetCore.Serilog.Test/Elmah.Io.AspNetCore.Serilog.Test.csproj +++ b/test/Elmah.Io.AspNetCore.Serilog.Test/Elmah.Io.AspNetCore.Serilog.Test.csproj @@ -2,6 +2,7 @@ net6.0;net7.0;net8.0 + 12.0 diff --git a/test/Elmah.Io.AspNetCore.Serilog.Test/ElmahIoSerilogMiddlewareTest.cs b/test/Elmah.Io.AspNetCore.Serilog.Test/ElmahIoSerilogMiddlewareTest.cs index d26f33f..def0322 100644 --- a/test/Elmah.Io.AspNetCore.Serilog.Test/ElmahIoSerilogMiddlewareTest.cs +++ b/test/Elmah.Io.AspNetCore.Serilog.Test/ElmahIoSerilogMiddlewareTest.cs @@ -32,10 +32,7 @@ public async Task MiddlewareCanDecorateLogContext() httpContext.Request.Path = new PathString("/test"); httpContext.Request.Method = "GET"; httpContext.Response.StatusCode = 404; - httpContext.User = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] - { - new Claim(ClaimTypes.Name, "User") - })); + httpContext.User = new ClaimsPrincipal(new ClaimsIdentity([new(ClaimTypes.Name, "User")])); httpContext.Request.Headers.Add("RequestKey", new StringValues("RequestValue")); // Act