Skip to content

Upgraded Test Project runtime and XUnit nuget packages - #79

Open
ByronMayne wants to merge 4 commits into
masterfrom
78-chore-upgrade-unit-test-projects-to-net-10-and-testing-nuget-packages
Open

ByronMayne wants to merge 4 commits into
masterfrom
78-chore-upgrade-unit-test-projects-to-net-10-and-testing-nuget-packages

Conversation

@ByronMayne

Copy link
Copy Markdown
Owner

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.

Also bumped the version of xUnit that is being used
Copilot AI balanced review requested due to automatic review settings October 4, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 1 Low severity

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 *.Tests project settings in Directory.Build.props and removed per-project PropertyGroups from both test .csproj files.
  • Replaced xunit/xunit.runner.visualstudio/coverlet.collector references with xunit.v3 (version 4.0.1 added to Directory.Packages.props).
  • Updated CompiliationTestBase.cs to use Xunit.Sdk and made TestMethod access null-safe, and dropped now-invalid using 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" />
Comment thread src/Directory.Build.props
Comment on lines +42 to +44
<IsPackable>false</IsPackable>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chore | Upgrade unit test projects to .net 10 and testing nuget packages

2 participants