From 5d6dfc609b14b33fd48221ff395ac75be6e5c142 Mon Sep 17 00:00:00 2001 From: "fabian.bornschlegl" Date: Tue, 30 Jan 2024 14:14:17 +0100 Subject: [PATCH] (nunit): major update --- Directory.Packages.props | 2 +- .../Logging/RequestLoggingTests.cs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3b79268..7f92c0c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -92,7 +92,7 @@ - + diff --git a/PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/Logging/RequestLoggingTests.cs b/PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/Logging/RequestLoggingTests.cs index d73b8bd..607f9f2 100644 --- a/PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/Logging/RequestLoggingTests.cs +++ b/PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/Logging/RequestLoggingTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using Microsoft.AspNetCore.Http; using NUnit.Framework; using PiBox.Hosting.WebHost.Logging; @@ -17,7 +18,7 @@ public void TestDetermineLoggingIsSettingTheLevelToErrorForTheGivenPathsStatusco StructuredLoggingExtensions.DetermineRequestLogLevel(new[] { "/metrics-text" })(httpContext, 0, null); - Assert.AreEqual(LogEventLevel.Error, logLevel); + LogEventLevel.Error.Should().Be(logLevel); } [Test] @@ -31,7 +32,7 @@ public void TestDetermineLoggingIsSettingTheLevelToErrorForTheGivenPathsExceptio StructuredLoggingExtensions.DetermineRequestLogLevel(new[] { "/metrics-text" })(httpContext, 0, new Exception("test")); - Assert.AreEqual(LogEventLevel.Error, logLevel); + LogEventLevel.Error.Should().Be(logLevel); } [Test] @@ -45,7 +46,7 @@ public void TestDetermineLoggingIsExcludingTheGivenPaths() StructuredLoggingExtensions.DetermineRequestLogLevel(new[] { "/MeTRICS", "/metrics" })(httpContext, 0, null); - Assert.AreEqual(LogEventLevel.Verbose, logLevel); + LogEventLevel.Verbose.Should().Be(logLevel); } [Test] @@ -58,7 +59,7 @@ public void TestDetermineLoggingIsExcludingTheGivenWildcardPaths() StructuredLoggingExtensions.DetermineRequestLogLevel(new[] { "/MeTRICS", "/metrics*" })( httpContext, 0, null); - Assert.AreEqual(LogEventLevel.Verbose, logLevel); + LogEventLevel.Verbose.Should().Be(logLevel); } [Test] @@ -71,7 +72,7 @@ public void TestDetermineLoggingIsNotExcludingTheGivenWildcardPaths() var logLevel = StructuredLoggingExtensions.DetermineRequestLogLevel(new[] { "/hangfire*" })(httpContext, 0, null); - Assert.AreEqual(LogEventLevel.Information, logLevel); + LogEventLevel.Information.Should().Be(logLevel); } [TestCase("/metrics-text", new[] { "/MeTRICS", "/metrics" }, 499, null)] @@ -86,7 +87,7 @@ public void TestDetermineLoggingIsNotExcludingTheGivenPaths(string actualPath, I var logLevel = StructuredLoggingExtensions.DetermineRequestLogLevel(paths)(httpContext, 0, exception); - Assert.AreEqual(LogEventLevel.Information, logLevel); + LogEventLevel.Information.Should().Be(logLevel); } } }