From 20d35066e4128aaa3b942f654df6285a1238e0ff Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 16 Sep 2024 14:29:57 +0100 Subject: [PATCH 1/5] Add supressions for namespaces --- .../Logging/Xunit/GlobalSuppressions.cs | 15 +++++++++++++++ .../Logging/Xunit/Test/GlobalSuppressions.cs | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/C3D/Extensions/Logging/Xunit/GlobalSuppressions.cs create mode 100644 test/C3D/Extensions/Logging/Xunit/Test/GlobalSuppressions.cs diff --git a/src/C3D/Extensions/Logging/Xunit/GlobalSuppressions.cs b/src/C3D/Extensions/Logging/Xunit/GlobalSuppressions.cs new file mode 100644 index 0000000..d5845c8 --- /dev/null +++ b/src/C3D/Extensions/Logging/Xunit/GlobalSuppressions.cs @@ -0,0 +1,15 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", + Justification = "Extensions", Scope = "namespace", Target = "~N:C3D.Extensions.Xunit.Logging")] +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", + Justification = "Extensions", Scope = "namespace", Target = "~N:Xunit.Abstractions")] +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", + Justification = "Extensions", Scope = "namespace", Target = "~N:Microsoft.Extensions.Logging")] +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", + Justification = "Pending fs reorg", Scope = "namespace", Target = "~N:C3D.Extensions.Logging.Xunit.Utilities")] diff --git a/test/C3D/Extensions/Logging/Xunit/Test/GlobalSuppressions.cs b/test/C3D/Extensions/Logging/Xunit/Test/GlobalSuppressions.cs new file mode 100644 index 0000000..96442ce --- /dev/null +++ b/test/C3D/Extensions/Logging/Xunit/Test/GlobalSuppressions.cs @@ -0,0 +1,9 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", + Justification = "Assembly name needs to end in .Tests", Scope = "namespace", Target = "~N:C3D.Extensions.Logging.Xunit.Test")] From 67686cbac9aa38e937549622a3f7d4ee2c41a4cb Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 16 Sep 2024 14:30:25 +0100 Subject: [PATCH 2/5] Allow Microsoft.Extensions.TimeProvider.Testing on net48 --- .../Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj b/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj index 657e840..c2bebb4 100644 --- a/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj +++ b/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj @@ -8,6 +8,7 @@ true $(SolutionDir)\src\C3D\Extensions\Logging\Xunit\ + true From 47ef2d7a2d356976183c6aa73acd5a1b7e45758d Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 16 Sep 2024 14:30:48 +0100 Subject: [PATCH 3/5] Make ConfigureLogger fixture method static --- test/C3D/Extensions/Logging/Xunit/Test/LoggingTestFixture.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/C3D/Extensions/Logging/Xunit/Test/LoggingTestFixture.cs b/test/C3D/Extensions/Logging/Xunit/Test/LoggingTestFixture.cs index 6e15ea8..bc5a040 100644 --- a/test/C3D/Extensions/Logging/Xunit/Test/LoggingTestFixture.cs +++ b/test/C3D/Extensions/Logging/Xunit/Test/LoggingTestFixture.cs @@ -23,7 +23,7 @@ private static IConfiguration CreateConfiguration() } - private ILoggingBuilder ConfigureLogger(ILoggingBuilder builder, IConfiguration configuration) => builder + private static ILoggingBuilder ConfigureLogger(ILoggingBuilder builder, IConfiguration configuration) => builder .ClearProviders() .SetMinimumLevel(LogLevel.Debug) .AddConfiguration(configuration.GetSection("Logging")) From 5b1ea3d6c75ecae07b25888f93855d93648be358 Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 16 Sep 2024 14:33:40 +0100 Subject: [PATCH 4/5] Use Assert.Single instead of Assert.Collection --- test/C3D/Extensions/Logging/Xunit/Test/TestOutputHelperTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/C3D/Extensions/Logging/Xunit/Test/TestOutputHelperTests.cs b/test/C3D/Extensions/Logging/Xunit/Test/TestOutputHelperTests.cs index bf71dca..32afc03 100644 --- a/test/C3D/Extensions/Logging/Xunit/Test/TestOutputHelperTests.cs +++ b/test/C3D/Extensions/Logging/Xunit/Test/TestOutputHelperTests.cs @@ -138,7 +138,7 @@ public void CreateLoggerFiltersMessages() var messages = wrapper.Messages; - Assert.Collection(messages, s => s.EndsWith(info)); + Assert.Single(messages, s => s.EndsWith(info)); } [Fact] From ebe98baacb6b7f73d2b71e8fbb2fc8cfd7d94de1 Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Mon, 16 Sep 2024 14:33:55 +0100 Subject: [PATCH 5/5] Do not use prerelease SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 1f1be53..b4faa52 100644 --- a/global.json +++ b/global.json @@ -2,7 +2,7 @@ "sdk": { "version": "8.0.400", "rollForward": "latestMajor", - "allowPrerelease": true + "allowPrerelease": false }, "msbuild-sdks": { }