Retarget exercise 3 to net10.0 and verify with dotnet test

Verified with SDK 10.0.4xx (mise): builds clean, solution test green
deterministically, pristine test flaky as designed (failed 2/3 runs).
net7.0 runtime is out of support and unavailable, so the exercise now
targets net10.0; MSTest bumped 2.1.1 -> 3.6.4 to silence the NU1903
transitive-dependency warning. .gitignore for bin/obj.
This commit is contained in:
Your Name
2026-09-28 21:53:01 +00:00
parent 1189041d8e
commit 679e95eb83
8 changed files with 24 additions and 19 deletions
@@ -0,0 +1,3 @@
bin/
obj/
*.user
@@ -5,7 +5,8 @@ A third, minimal example in the same kata theme: the sellers exist
`Buyers` computes a buyer's shopping-list total, and `PriceList` stands for an `Buyers` computes a buyer's shopping-list total, and `PriceList` stands for an
external pricing service (it adds random surge pricing, so the test is flaky). external pricing service (it adds random surge pricing, so the test is flaky).
Written in **C#** (MSTest, .NET 7 — same setup as the kata's `csharp/` folder). Written in **C#** (MSTest, .NET 10; verified with `dotnet test` on SDK
10.0.4xx — pristine test is flaky by design, solution is deterministic).
Run with `dotnet test test/BuyersTests.csproj`. Run with `dotnet test test/BuyersTests.csproj`.
Contents: Contents:
@@ -33,8 +34,9 @@ Next-time arc: marketing adds surge discounts, `PriceList` grows
`DiscountFor(...)` — two methods to stub → extract a role interface `DiscountFor(...)` — two methods to stub → extract a role interface
(`IPricing`) instead of two lambdas. See the demo script's closing note. (`IPricing`) instead of two lambdas. See the demo script's closing note.
## Not verified by a build ## Verified
This exercise was authored without a local .NET SDK (structurally mirrored from Built and run with `dotnet test` (SDK 10.0.4xx): solution green deterministically,
the kata's `csharp/` project files). Run `dotnet test test/BuyersTests.csproj` pristine test flaky (failed 2 of 3 runs, passed 1 — both surges rolled 0).
once on a machine with the SDK before facilitating. MSTest bumped to 3.6.4 (kata ships 2.1.1, whose transitive Newtonsoft.Json trips
a NU1903 vulnerability warning).
@@ -1,7 +1,7 @@
{ {
"sdk": { "sdk": {
"version": "7.0.0", "version": "10.0.0",
"rollForward": "latestMajor", "rollForward": "latestFeature",
"allowPrerelease": true "allowPrerelease": true
} }
} }
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" /> <PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" /> <PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -1,7 +1,7 @@
{ {
"sdk": { "sdk": {
"version": "7.0.0", "version": "10.0.0",
"rollForward": "latestMajor", "rollForward": "latestFeature",
"allowPrerelease": true "allowPrerelease": true
} }
} }
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" /> <PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" /> <PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>