From b55ae4f8c23ff9a9aea9451f0b1e2dffbb3817bc Mon Sep 17 00:00:00 2001 From: Jake Aitchison Date: Mon, 16 Nov 2026 11:58:31 +0000 Subject: [PATCH 1/2] chore: migrate test projects to microsoft.testing.platform Enable the NUnit MTP runner for the test projects through a new tests/Directory.Build.props and opt dotnet test into native MTP mode in global.json. Replace Microsoft.NET.Test.Sdk and coverlet.collector with Microsoft.Testing.Extensions.CodeCoverage and Microsoft.Testing.Extensions.TrxReport, and update the workflow and psake dotnet test invocations to the MTP switches. --- .github/workflows/build-status.yml | 16 ++++++++-------- .github/workflows/receive-pr.yml | 16 ++++++++-------- build/default.ps1 | 10 +++++----- global.json | 5 ++++- tests/Directory.Build.props | 7 +++++++ tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj | 7 ++----- .../NHapi.NUnit.SourceGeneration.csproj | 7 ++----- tests/NHapi.NUnit/NHapi.NUnit.csproj | 7 ++----- 8 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 tests/Directory.Build.props diff --git a/.github/workflows/build-status.yml b/.github/workflows/build-status.yml index de9d38b3b..292e6bf34 100644 --- a/.github/workflows/build-status.yml +++ b/.github/workflows/build-status.yml @@ -39,11 +39,11 @@ jobs: - name: Run tests for all target frameworks (Windows) if: matrix.os == 'windows-latest' run: | - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build + dotnet test --project tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - name: Run Benchmatks (Windows) if: matrix.os == 'windows-latest' @@ -53,9 +53,9 @@ jobs: - name: Run tests for all target frameworks (Non-Windows) if: matrix.os != 'windows-latest' run: | - dotnet test tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --results-directory TestResults --results-directory-layout per-module --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.NUnit/NHapi.NUnit.csproj --results-directory TestResults --results-directory-layout per-module --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml -c Release -f net10.0 --no-restore --no-build - name: Upload Benchmark Results if: always() && matrix.os == 'windows-latest' diff --git a/.github/workflows/receive-pr.yml b/.github/workflows/receive-pr.yml index 21a387af9..e1dc20f95 100644 --- a/.github/workflows/receive-pr.yml +++ b/.github/workflows/receive-pr.yml @@ -37,11 +37,11 @@ jobs: - name: Run tests for all target frameworks (Windows) if: matrix.os == 'windows-latest' run: | - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" --results-directory TestResults -c Release -f net462 --no-restore --no-build - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --logger "trx;LogFilePrefix=TestResults" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" --results-directory TestResults -c Release -f net462 --no-restore --no-build - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --report-trx --results-directory TestResults -c Release -f net462 --no-restore --no-build + dotnet test --project tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --report-trx --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --report-trx --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit\NHapi.NUnit.csproj --report-trx --results-directory TestResults -c Release -f net462 --no-restore --no-build + dotnet test --project tests\NHapi.NUnit\NHapi.NUnit.csproj --report-trx --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - name: Run Benchmatks (Windows) if: matrix.os == 'windows-latest' @@ -51,9 +51,9 @@ jobs: - name: Run tests for all target frameworks (Non-Windows) if: matrix.os != 'windows-latest' run: | - dotnet test tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build - dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --results-directory TestResults --results-directory-layout per-module --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build + dotnet test --project tests/NHapi.NUnit/NHapi.NUnit.csproj --results-directory TestResults --results-directory-layout per-module --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml -c Release -f net10.0 --no-restore --no-build - name: Upload Unit Test Results if: always() && matrix.os == 'windows-latest' diff --git a/build/default.ps1 b/build/default.ps1 index b5feb7fce..b1caa5d02 100644 --- a/build/default.ps1 +++ b/build/default.ps1 @@ -65,11 +65,11 @@ task Test { # TODO: Move to using dotnet test to execute the unit tests # the below works however the output format needs to be tweeked. - exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build } - exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build } - exec { dotnet test ..\tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } - exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } - exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } + exec { dotnet test --project ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build } + exec { dotnet test --project ..\tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build } + exec { dotnet test --project ..\tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } + exec { dotnet test --project ..\tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } + exec { dotnet test --project ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net10.0 --no-restore --no-build } } Task Package -depends Build { diff --git a/global.json b/global.json index 2f59669d9..ca34b5d26 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "10.0.404", "rollForward": "latestFeature" }, - "projects": [] + "projects": [], + "test": { + "runner": "Microsoft.Testing.Platform" + } } \ No newline at end of file diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 000000000..338d6276f --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,7 @@ + + + + Exe + true + + diff --git a/tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj b/tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj index 2176b0fe8..068ecc65c 100644 --- a/tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj +++ b/tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj @@ -18,13 +18,10 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj b/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj index e87cb5aad..c52b9fe68 100644 --- a/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj +++ b/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj @@ -20,11 +20,8 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/NHapi.NUnit/NHapi.NUnit.csproj b/tests/NHapi.NUnit/NHapi.NUnit.csproj index a352c2e39..8c272a075 100644 --- a/tests/NHapi.NUnit/NHapi.NUnit.csproj +++ b/tests/NHapi.NUnit/NHapi.NUnit.csproj @@ -30,11 +30,8 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + all runtime; build; native; contentfiles; analyzers; buildtransitive From 1659c1a81e04ec3b82ed60e43d8d3fd00f7ef1d9 Mon Sep 17 00:00:00 2001 From: Jake Aitchison Date: Mon, 16 Nov 2026 11:59:57 +0000 Subject: [PATCH 2/2] chore: move verify sponsorship exemption to tests directory props --- tests/Directory.Build.props | 6 ++++++ .../NHapi.NUnit.SourceGeneration.csproj | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 338d6276f..797ce1eb3 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -4,4 +4,10 @@ Exe true + + + + OpenSource + 2027-10 + diff --git a/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj b/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj index c52b9fe68..f227ea6d7 100644 --- a/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj +++ b/tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj @@ -3,9 +3,6 @@ net10.0 false - - OpenSource - 2027-10