Skip to content

Commit 8a9feed

Browse files
Require tests to pass on net472 and net8.0
Enable binding redirect generation and add System.Collections.Immutable for net472 tests to satisfy MSTest 3.x at runtime. Update migrate-prompt.md to run the dotnet test command with a longer tail output and tighten guidance: record pass/fail counts for both net472 and net8.0 and require all tests to pass on both frameworks before proceeding. Also clarified failure-handling and strengthened wording around regressions and fixes.
1 parent 7b89c15 commit 8a9feed

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

project/dbatools.Tests/dbatools.Tests.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
99
<IsCodedUITest>False</IsCodedUITest>
1010
<TestProjectType>UnitTest</TestProjectType>
11+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
12+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
1113
<AssemblyTitle>dbatools.Tests</AssemblyTitle>
1214
<Product>dbatools.Tests</Product>
1315
<Copyright>Copyright © 2021</Copyright>
@@ -42,6 +44,11 @@
4244
<ProjectReference Include="..\dbatools\dbatools.csproj" />
4345
</ItemGroup>
4446

47+
<!-- Fix net472 test runner: MSTest 3.x needs System.Collections.Immutable at runtime -->
48+
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
49+
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
50+
</ItemGroup>
51+
4552
<!-- PowerShell type references for testing Internal helpers -->
4653
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
4754
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0" PrivateAssets="all" />

scripts/migrate-prompt.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ dotnet clean (use dotnet build instead)
2323
Before making any changes, run the test suite to establish a baseline:
2424

2525
```bash
26-
dotnet test project/dbatools.Tests/dbatools.Tests.csproj --no-build --verbosity quiet 2>&1 | tail -5
26+
dotnet test project/dbatools.Tests/dbatools.Tests.csproj --verbosity quiet 2>&1 | tail -10
2727
```
2828

29-
Record the pass/fail count. Any test that passes now MUST still pass after your conversion. If the baseline itself has failures, note them — you are not responsible for pre-existing failures, but you must not add new ones.
29+
Record the pass/fail count for BOTH net472 and net8.0. ALL tests MUST pass on BOTH frameworks — zero failures, zero crashes. If the baseline has any failures on either framework, STOP and fix them before proceeding with the conversion. Do not ignore or skip failures on any framework.
3030

3131
#### Pester Baseline
3232

@@ -176,10 +176,10 @@ Loading the dev-built library first satisfies dbatools-ralph's `RequiredModules
176176
Run the test suite after the build to verify your conversion doesn't break anything:
177177

178178
```bash
179-
dotnet test project/dbatools.Tests/dbatools.Tests.csproj --no-build --verbosity quiet 2>&1 | tail -5
179+
dotnet test project/dbatools.Tests/dbatools.Tests.csproj --verbosity quiet 2>&1 | tail -10
180180
```
181181

182-
Compare against the baseline from Step 0. If any test that previously passed now fails, fix your code and re-run. Do not proceed until the test count is equal to or better than baseline.
182+
ALL tests MUST pass on BOTH net472 and net8.0. Compare against the baseline from Step 0. If any test fails on either framework, fix your code and re-run. Do not proceed until all tests pass on both frameworks.
183183

184184
### 5c. Write C# Unit Tests
185185

@@ -382,9 +382,9 @@ pwsh -NoProfile -Command '
382382
**Always use `pwsh -NoProfile`** — never test in the current session where the installed DLL may be locked or a stale module is loaded. The dev-built module at `artifacts/dbatools.library/` contains your freshly compiled `dbatools.dll` plus all dependency DLLs.
383383

384384
Compare results against the Pester baseline from Step 0:
385-
- **All tests that passed in the baseline MUST still pass.** A previously-passing test that now fails is a regression in your C# implementation.
386-
- **Pre-existing failures** (tests that failed in the baseline too) are not your responsibility, but document them.
387-
- **New passes** (tests that failed before but pass now) are a bonus — note them.
385+
- **ALL tests MUST pass.** There are no pre-existing failures — if something fails, it's a real problem that must be fixed.
386+
- A previously-passing test that now fails is a regression in your C# implementation — fix it.
387+
- If any test fails, determine the root cause and fix it before proceeding.
388388

389389
If any baseline-passing test now fails:
390390
1. Determine if the failure is a C# implementation issue or a test adaptation issue

0 commit comments

Comments
 (0)