From 5c447364f3fcd8fda68ecce76e38d63fd9db1e08 Mon Sep 17 00:00:00 2001 From: Raghu Date: Thu, 15 Oct 2026 12:37:51 +0100 Subject: [PATCH] CONFIG: Move The Test Projects To xunit 4 On The Microsoft Testing Platform Moves all four test projects to xunit.v3 4.0.2 with xunit.runner.visualstudio 4.0.1 and Microsoft.NET.Test.Sdk 18.11.0, and opts the repo into the Microsoft Testing Platform through global.json. The runner 4.x line no longer supports VSTest on the .NET 10 SDK, so the package move and the global.json switch are coupled: neither builds nor runs tests on its own. xunit.analyzers goes to 2.2.0 rather than the 2.0.0 Dependabot offers, because xunit.v3 4.0.2 depends on at least 2.2.0 and an explicit lower reference fails restore with NU1605. Also brings the Microsoft.Extensions family to 10.0.13 as one coupled set. FluentAssertions stays locked at [7.2.2]. The build workflow now runs tests in the Microsoft Testing Platform form. The platform needs --project to name a single test project, so the unit and acceptance steps use it, and --ignore-exit-code 8 treats "zero tests ran" as a pass where VSTest only warned; a real failure still exits 2. NEL.MESH.Tests.Integration.Witness has no tests and is the reason the flag is needed, though the workflow does not run it. The workflow was regenerated from the Infrastructure generator, not hand-edited, and running the generator twice produces identical files. Tests: 292 unit, 10 acceptance and 8 integration all passing. --- .github/workflows/build.yml | 4 ++-- .../Services/ScriptGenerationService.cs | 10 ++++++---- .../NEL.MESH.Tests.Acceptance.csproj | 12 ++++++------ .../NEL.MESH.Tests.Integration.Witness.csproj | 12 ++++++------ .../NEL.MESH.Tests.Integration.csproj | 12 ++++++------ NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj | 12 ++++++------ NEL.MESH.UI/NEL.MESH.UI.csproj | 8 ++++---- NEL.MESH/NEL.MESH.csproj | 4 ++-- global.json | 5 +++++ 9 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 global.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46de64d..266d1d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,9 +33,9 @@ jobs: - name: Build run: dotnet build --no-restore - name: Unit Tests - run: dotnet test NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj --no-build --verbosity normal + run: dotnet test --project NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj --no-build --verbosity normal --ignore-exit-code 8 - name: Acceptance Tests - run: dotnet test NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj --no-build --verbosity normal + run: dotnet test --project NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj --no-build --verbosity normal --ignore-exit-code 8 add_tag: name: Add Tag and Create Release runs-on: ubuntu-latest diff --git a/NEL.MESH.Infrastructure/Services/ScriptGenerationService.cs b/NEL.MESH.Infrastructure/Services/ScriptGenerationService.cs index cf3988c..940168b 100644 --- a/NEL.MESH.Infrastructure/Services/ScriptGenerationService.cs +++ b/NEL.MESH.Infrastructure/Services/ScriptGenerationService.cs @@ -83,16 +83,18 @@ public void GenerateBuildScript(string branchName, string projectName, string do { Name = "Unit Tests", - Run = $"dotnet test {projectName}.Tests.Unit/" + - $"{projectName}.Tests.Unit.csproj --no-build --verbosity normal" + Run = $"dotnet test --project {projectName}.Tests.Unit/" + + $"{projectName}.Tests.Unit.csproj " + + "--no-build --verbosity normal --ignore-exit-code 8" }, new TestTask { Name = "Acceptance Tests", - Run = $"dotnet test {projectName}.Tests.Acceptance/" + - $"{projectName}.Tests.Acceptance.csproj --no-build --verbosity normal" + Run = $"dotnet test --project {projectName}.Tests.Acceptance/" + + $"{projectName}.Tests.Acceptance.csproj " + + "--no-build --verbosity normal --ignore-exit-code 8" } } } diff --git a/NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj b/NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj index 9e85107..5bbbe92 100644 --- a/NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj +++ b/NEL.MESH.Tests.Acceptance/NEL.MESH.Tests.Acceptance.csproj @@ -12,18 +12,18 @@ - - - + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -31,7 +31,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/NEL.MESH.Tests.Integration.Witness/NEL.MESH.Tests.Integration.Witness.csproj b/NEL.MESH.Tests.Integration.Witness/NEL.MESH.Tests.Integration.Witness.csproj index f0f9b13..e068acf 100644 --- a/NEL.MESH.Tests.Integration.Witness/NEL.MESH.Tests.Integration.Witness.csproj +++ b/NEL.MESH.Tests.Integration.Witness/NEL.MESH.Tests.Integration.Witness.csproj @@ -16,17 +16,17 @@ - - - + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -34,7 +34,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/NEL.MESH.Tests.Integration/NEL.MESH.Tests.Integration.csproj b/NEL.MESH.Tests.Integration/NEL.MESH.Tests.Integration.csproj index 85ba952..e9f1f54 100644 --- a/NEL.MESH.Tests.Integration/NEL.MESH.Tests.Integration.csproj +++ b/NEL.MESH.Tests.Integration/NEL.MESH.Tests.Integration.csproj @@ -16,17 +16,17 @@ - - - + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -34,7 +34,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj b/NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj index 1012ed2..201087a 100644 --- a/NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj +++ b/NEL.MESH.Tests.Unit/NEL.MESH.Tests.Unit.csproj @@ -12,17 +12,17 @@ - - - + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -30,7 +30,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/NEL.MESH.UI/NEL.MESH.UI.csproj b/NEL.MESH.UI/NEL.MESH.UI.csproj index e0f8612..84638cb 100644 --- a/NEL.MESH.UI/NEL.MESH.UI.csproj +++ b/NEL.MESH.UI/NEL.MESH.UI.csproj @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/NEL.MESH/NEL.MESH.csproj b/NEL.MESH/NEL.MESH.csproj index bb0f1ba..59ed2a9 100644 --- a/NEL.MESH/NEL.MESH.csproj +++ b/NEL.MESH/NEL.MESH.csproj @@ -51,8 +51,8 @@ - - + + diff --git a/global.json b/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +}