feat: Migrate test framework from XUnit to TUnit 1.2.11#232
Merged
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Comment |
Copilot
AI
changed the title
[WIP] Migrate test framework from XUnit to TUnit 1.2.11
Migrate test framework from XUnit to TUnit 1.2.11
Nov 23, 2025
e0135d8 to
faf9503
Compare
776d245 to
43c8063
Compare
samtrion
approved these changes
Dec 5, 2025
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
- Updated using statements in all test files - Converted [Fact] to [Test] - Converted Assert methods to TUnit equivalents - Made test classes public partial - Still fixing compilation errors in WindowsFormsSynchronizationContextProviderTests.cs Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
- Removed explicit TUnit using statements (using global usings) - Added await to all Assert.That statements - Need to convert synchronous test methods to async - Need to fix Assert.Throws patterns Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
43c8063 to
422732f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #232 +/- ##
=========================================
+ Coverage 0 96.79% +96.79%
=========================================
Files 0 7 +7
Lines 0 343 +343
Branches 0 31 +31
=========================================
+ Hits 0 332 +332
- Misses 0 8 +8
- Partials 0 3 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
samtrion
approved these changes
Dec 5, 2025
samtrion
approved these changes
Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Migrates all test projects from XUnit 2.9.3 to TUnit 1.2.11 as specified in the issue requirements.
Package Changes
xunit,xunit.runner.visualstudio,NetEvolve.Extensions.XUnit,TngTech.ArchUnitNET.xUnit,Verify.Xunit) with TUnit equivalentsTUnit1.2.11,TUnit.Assertions1.2.11,NetEvolve.Extensions.TUnit3.0.0,TngTech.ArchUnitNET.TUnit0.12.3,Verify.TUnit31.7.2.csprojfiles to reference TUnit packagesTest Code Migration
[Fact]→[Test]attributes across all test filespublic partial(required by TUnit source generators)awaitto all assertion statements (TUnit assertions returnTask)Architecture Tests
ArchUnitNET.xUnittoArchUnitNET.TUnitKnown TUnit Differences
TUnit's primary difference from XUnit: all assertions are async and must be awaited. This requires:
awaitbeforeAssert.That()andAssert.Throws()async Task[Theory]/[MemberData]patterns differently (use multiple[Arguments]attributes)Remaining Work
async TaskAssert.Throwspatterns need refinement (exception variable assignment shouldn't be awaited)[Theory]test inIServiceCollectionExtensionsTests.csneeds conversion to[Arguments]patternWhy is it important?
TUnit provides modern .NET testing capabilities with source generators, improved async/await support, and better performance through Microsoft.Testing.Platform integration as configured in
global.json.Related issues
How to test this PR
dotnet build Extensions.Hosting.WinForms.slnx dotnet test Extensions.Hosting.WinForms.slnxNote: Build currently fails with ~100 errors related to remaining synchronous methods needing async conversion. These are mechanical fixes following the pattern established in completed test files.
Follow-ups
After completing the remaining async conversions:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.