Repository navigation
Upgraded Test Project runtime and XUnit nuget packages - #79
ByronMayne wants to merge 4 commits into
Conversation
Also bumped the version of xUnit that is being used
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The CI workflow still provisions only the .NET 6 SDK (incompatible with the new net10.0 target), and dropping xunit.runner.visualstudio while keeping Microsoft.NET.Test.Sdk will likely cause dotnet test to discover no tests.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
This PR modernizes the repository's test tooling. It upgrades both unit-test projects to target net10.0 (previously net6.0 and net8.0) and migrates them from the deprecated xunit v2 packages to xunit.v3. Shared test settings (target framework, IsPackable, IsTestProject, ImplicitUsings) are centralized in src/Directory.Build.props via a condition on *.Tests projects, and the obsolete Xunit.Abstractions usings are removed since those types moved namespaces in v3.
Changes:
- Centralized
*.Testsproject settings inDirectory.Build.propsand removed per-projectPropertyGroups from both test.csprojfiles. - Replaced
xunit/xunit.runner.visualstudio/coverlet.collectorreferences withxunit.v3(version4.0.1added toDirectory.Packages.props). - Updated
CompiliationTestBase.csto useXunit.Sdkand madeTestMethodaccess null-safe, and dropped now-invalidusing Xunit.Abstractions;from test files.
| File | Description |
|---|---|
| src/Directory.Build.props | Adds a *.Tests PropertyGroup setting net10.0, IsTestProject, ImplicitUsings; contains a duplicated IsPackable. |
| src/Directory.Packages.props | Adds xunit.v3 4.0.1 central package version. |
| src/SourceGenerator.Foundations.Tests/SourceGenerator.Foundations.Tests.csproj | Removes inline framework/packages, adds xunit.v3, drops the VSTest adapter. |
| src/Sandbox/ConsoleApp.SourceGenerator.Tests/ConsoleApp.SourceGenerator.Tests.csproj | Same migration; relies on central settings and xunit.v3. |
| src/SourceGenerator.Foundations.Tests/CompiliationTestBase.cs | Switches to Xunit.Sdk; null-safe TestMethod.ToString(). |
| src/SourceGenerator.Foundations.Tests/SourceGeneratorAnalyzerTests.cs | Removes obsolete using Xunit.Abstractions;. |
| src/SourceGenerator.Foundations.Tests/ExtendedAnalyzerRuleTests.cs | Removes obsolete using Xunit.Abstractions;. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| <PackageReference Include="xunit.runner.visualstudio" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
| <PackageReference Include="Newtonsoft.Json" /> | ||
| <PackageReference Include="xunit.v3" /> |
| to reference the type, so that is this weird workaround of using the path and navigating to the dll | ||
| --> | ||
| <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" GeneratePathProperty="true" /> | ||
| <PackageReference Include="xunit.v3" /> |
| <IsPackable>false</IsPackable> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <IsPackable>false</IsPackable> |


Upgraded both unit test projects to .net 10 because one was on 8 and the other 6. Removed the depreciated xunit to the new poorly named xunit.v3 packages.