Migrate BusinessMgr tests to NUnit

This commit is contained in:
Andy Howard
2026-09-15 10:29:35 +01:00
parent 3f2f8c16ef
commit de07f2120f
16 changed files with 333 additions and 411 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ Last updated: 2026-09-14
| Component | Scope | Status | Date reviewed | Next steps | Notes |
|---|---|---|---|---|---|
| `BusinessMgr.sln` | .NET 10 restore, Debug build, and tests | Migrated; passing with warnings and toolchain requirement | 2026-09-13 | Review remaining framework-specific packages, perform application smoke tests, then release-validate. | All eight projects target `net10.0`. The complete solution builds with Visual Studio 18 MSBuild; the .NET CLI cannot build `SaBusMgrTest_Portal` because its SSDT SQL unit-testing targets are Visual Studio-specific (`MSB4278`). Control tests pass 11 of 11 and Portal tests pass 13 of 13. The Identity-related `NU1903` warnings have been removed. |
| `BusinessMgr.sln` | .NET 10 restore, Debug build, and tests | Migrated; passing with warnings | 2026-09-14 | Review remaining framework-specific packages, perform application smoke tests, then release-validate. | All eight projects target `net10.0`. The complete solution now restores and builds with the .NET CLI after unused SSDT SQL unit-testing scaffolding was removed from the Portal tests. Control tests pass 11 of 11 and Portal tests pass 13 of 13. The Identity-related `NU1903` warnings have been removed. |
| `SaBusMgrStandardBase/Base/Helpers/SbmPasswordHelper.cs` and `SaBusinessMgrCoreWebControl/Control/Helpers/SbmcPasswordHelper.cs` | Password hashing | Dependency upgrade complete; legacy hashes compatible | 2026-09-13 | Preserve the compatibility tests when password-hashing defaults or account migration behavior changes. | Both helpers use `PasswordHasher<TUser>` from `Microsoft.Extensions.Identity.Core` 10.0.12. Current hashes round-trip, wrong passwords fail, and legacy Identity V3 hashes remain valid while being identified for rehash. |
| `eng/validate.ps1` | Repository validation | Complete; passing | 2026-09-13 | Use as the standard validation entry point and extend it when repository-wide checks change. | Locates Visual Studio MSBuild for the SSDT project, builds serially, runs 11 Control and 13 Portal tests, audits the Identity-package-owning project, and verifies changed-file line endings and diffs. |
| `SaBusMgrTest_Control` and `SaBusMgrTest_Portal` | Test SDK and coverage tooling | Current; coverage verified | 2026-09-14 | Preserve the analyzer-clean build and explicit coverage validation during future test-tool upgrades. | Both projects use Microsoft.NET.Test.Sdk 18.10.0, MSTest 4.4.0, and coverlet collector 10.0.1. Control passes 11 tests and Portal passes 13 tests without MSTest analyzer warnings. The optional validation coverage mode verifies a non-empty Cobertura report from each suite and handles Portal's Visual Studio-only SSDT targets through an MSBuild publish step. |
| `eng/validate.ps1` | Repository validation | Complete; passing | 2026-09-14 | Use as the standard validation entry point and extend it when repository-wide checks change. | Restores and builds serially with the .NET CLI, runs 11 Control and 13 Portal NUnit tests, audits the Identity-package-owning project, and verifies changed-file line endings and diffs. |
| `SaBusMgrTest_Control` and `SaBusMgrTest_Portal` | Test framework, SDK, and coverage tooling | Migrated to NUnit; coverage verified | 2026-09-15 | Use NUnit constraint assertions with `Assert.That` wherever possible. | Both projects use Microsoft.NET.Test.Sdk 18.10.0, NUnit 4.6.1, NUnit3TestAdapter 6.3.0, NUnit.Analyzers 4.15.0, and coverlet collector 10.0.1. All tests use NUnit's constraint assertion model; Control passes 11 tests and Portal passes 13 tests. The Control base fixture constructs valid session data from the configured test account, avoiding a null session in console tests. The optional validation coverage mode verifies a non-empty Cobertura report from each suite without an SSDT-specific publish step. |
+1
View File
@@ -34,6 +34,7 @@ Last updated: 2026-09-14
| Topic | Date noted | Date started | Date completed | Outcome |
|---|---|---|---|---|
| Migrate BusinessMgr tests from MSTest to NUnit | 2026-09-14 | 2026-09-14 | 2026-09-15 | Replaced MSTest with NUnit 4.6.1, NUnit3TestAdapter 6.3.0, and NUnit.Analyzers 4.15.0 in both test projects. Converted all eight fixtures and 24 tests to NUnit's constraint-style `Assert.That` model and brought every migrated fixture into line with the repository's section-comment convention. Removed unused Portal SSDT SQL unit-testing references and targets plus one unused transitive Application Insights namespace dependency. The Control base fixture now constructs representative session data instead of passing an uninitialised null value, removing its nullable warning and ensuring its console tests exercise a valid user session. The complete solution builds with the .NET CLI; Control passes 11 tests and Portal passes 13 tests, including coverage collection. |
| Capture the pre-migration BusinessMgr build and test baseline | 2026-09-10 | 2026-09-10 | 2026-09-10 | Using SDK 10.0.401, restore succeeded. Visual Studio 18 MSBuild built the complete Debug solution successfully, including the SSDT-dependent Portal test project. The .NET CLI built all production projects and the Control tests but reports `MSB4278` for the Portal test project's Visual Studio SSDT import, so Visual Studio MSBuild remains required for that project. Common's MailKit 4.13.0 dependency reports `NU1902`; the CLI build otherwise recorded 20 compiler warnings. Control tests passed 8 of 8 and Portal tests passed 13 of 13. |
| Pin the BusinessMgr .NET 10 SDK | 2026-09-10 | 2026-09-10 | 2026-09-10 | Added `global.json` for SDK 10.0.401 with `latestPatch` roll-forward and prerelease SDKs disabled. Visual Studio MSBuild remains required for the SSDT-dependent Portal test project. |
| Migrate BusinessMgr to .NET 10 against compatible Common targets | 2026-09-10 | 2026-09-10 | 2026-09-10 | All eight BusinessMgr projects now target `net10.0`. Visual Studio 18 MSBuild restored and built the complete solution successfully with no compilation errors. Control tests passed 8 of 8 and Portal tests passed 13 of 13 on .NET 10. Package vulnerability and framework-specific package reviews are tracked separately. |