Skip to content

refactor: migrate to TUnit - #726

Draft
vbreuss wants to merge 1 commit into
mainfrom
topic/migrate-to-tunit
Draft

refactor: migrate to TUnit#726
vbreuss wants to merge 1 commit into
mainfrom
topic/migrate-to-tunit

Conversation

@vbreuss

@vbreussvbreuss commented Apr 30, 2026

Copy link
Copy Markdown
Member

This PR migrates the test framework from xUnit to TUnit by replacing test attributes and updating helper utilities.

Key Changes

  • Replaced [Fact] attributes with [Test] throughout test files
  • Replaced [Theory]/[InlineData] with [Test]/[Arguments] for parameterized tests
  • Changed global using from Xunit to TUnit in the test helpers
  • Added a new Record helper class to replace xUnit's Record.Exception functionality
  • Updated assertion syntax in delegate tests to use aweXpect instead of xUnit assertions
  • Uses the latest Stryker version that supports MTP

@vbreussvbreuss self-assigned this Apr 30, 2026
@github-actions

Copy link
Copy Markdown

Test Results

21 files ± 0 21 suites ±0 25m 15s ⏱️ + 15m 42s
3 849 tests - 11 3 837 ✅ - 21 0 💤 - 2 12 ❌ +12 
25 090 runs - 4 25 012 ✅ - 78 0 💤 - 4 78 ❌ +78 

For more details on these failures, see this check.

Results for commit 74ff11c. ± Comparison against base commit c12680a.

@github-actions

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.46GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

MethodMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Event_Mockolate408.5 ns10.95 ns10.24 ns1.000.030.12540.00052.05 KB1.00
Event_Moq17,635.9 ns153.48 ns128.16 ns43.201.090.7324-12.51 KB6.09
Event_NSubstitute6,527.8 ns127.28 ns119.06 ns15.990.480.54930.00769.05 KB4.40
Event_FakeItEasy222,978.6 ns975.88 ns865.09 ns546.2013.340.4883-15.35 KB7.47
Event_Imposter1,697.4 ns43.02 ns40.24 ns4.160.140.53790.01538.8 KB4.29
Event_TUnitMocks212.1 ns3.64 ns3.23 ns0.520.010.08180.00021.34 KB0.65
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v4

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

MethodNMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Indexer_Mockolate1996.5 ns7.01 ns6.21 ns1.000.010.1640-4.03 KB1.00
Indexer_Moq1163,660.7 ns1,431.44 ns1,338.97 ns164.241.630.4883-20.36 KB5.05
Indexer_NSubstitute19,002.7 ns58.40 ns54.63 ns9.030.080.5188-12.78 KB3.17
Indexer_FakeItEasy110,286.9 ns79.59 ns74.45 ns10.320.100.56460.015313.87 KB3.44
Indexer_Imposter1885.4 ns5.98 ns5.30 ns0.890.010.20980.00295.16 KB1.28
Indexer_Mockolate102,768.8 ns9.52 ns7.95 ns1.000.000.2060-5.09 KB1.00
Indexer_Moq10170,939.6 ns682.26 ns604.80 ns61.740.270.97660.732429.89 KB5.88
Indexer_NSubstitute1021,311.8 ns129.68 ns114.96 ns7.700.051.03760.030525.58 KB5.03
Indexer_FakeItEasy1021,995.2 ns114.17 ns106.79 ns7.940.041.43430.061035.48 KB6.98
Indexer_Imposter102,106.8 ns10.91 ns10.21 ns0.760.000.3242-7.97 KB1.57
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

MethodNMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Method_Mockolate1466.7 ns4.04 ns3.78 ns1.000.010.14160.00102.32 KB1.00
Method_Moq1182,091.0 ns498.50 ns416.27 ns390.233.180.4883-14.58 KB6.28
Method_NSubstitute15,947.7 ns25.60 ns22.69 ns12.750.110.55690.00769.12 KB3.93
Method_FakeItEasy16,296.6 ns29.93 ns23.37 ns13.490.120.4959-8.11 KB3.50
Method_Imposter1632.5 ns15.02 ns14.05 ns1.360.030.24700.00294.04 KB1.74
Method_TUnitMocks1466.7 ns10.23 ns9.07 ns1.000.020.11490.00051.88 KB0.81
Method_Mockolate10778.0 ns9.59 ns8.97 ns1.000.020.15450.00102.53 KB1.00
Method_Moq10187,873.4 ns934.18 ns828.13 ns241.522.890.97660.732418.48 KB7.30
Method_NSubstitute108,865.7 ns105.50 ns93.52 ns11.400.170.73240.015312.07 KB4.77
Method_FakeItEasy109,501.6 ns76.80 ns71.84 ns12.210.160.97660.030516.05 KB6.34
Method_Imposter101,229.5 ns35.70 ns33.39 ns1.580.050.33760.00575.52 KB2.18
Method_TUnitMocks101,317.8 ns17.02 ns15.92 ns1.690.030.21550.00193.52 KB1.39
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v4

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

MethodNMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Property_Mockolate1644.8 ns6.56 ns6.14 ns1.000.010.1049-2.58 KB1.00
Property_Moq110,818.1 ns43.47 ns38.54 ns16.780.160.3662-10.39 KB4.03
Property_NSubstitute17,767.8 ns23.29 ns20.65 ns12.050.120.4578-11.45 KB4.44
Property_FakeItEasy18,228.2 ns43.23 ns38.32 ns12.760.130.4578-11.25 KB4.36
Property_Imposter1542.7 ns7.52 ns7.04 ns0.840.010.12680.00103.13 KB1.21
Property_TUnitMocks1494.1 ns3.41 ns3.19 ns0.770.010.0601-1.49 KB0.58
Property_Mockolate101,348.0 ns6.67 ns6.24 ns1.000.010.1240-3.07 KB1.00
Property_Moq1017,416.9 ns29.40 ns24.55 ns12.920.060.7324-18.28 KB5.95
Property_NSubstitute1016,848.2 ns40.28 ns37.67 ns12.500.060.8545-21.08 KB6.87
Property_FakeItEasy1019,572.7 ns65.71 ns61.47 ns14.520.081.25120.030530.8 KB10.03
Property_Imposter101,423.5 ns19.41 ns18.15 ns1.060.010.18880.00194.67 KB1.52
Property_TUnitMocks101,754.6 ns6.56 ns6.14 ns1.300.010.1488-3.65 KB1.19
Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.76GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.203
[Host] : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

MethodMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Callback_Mockolate408.9 ns6.48 ns5.41 ns1.000.020.1197-1.96 KB1.00
Callback_Moq98,122.6 ns883.92 ns826.82 ns240.033.590.48830.24418.88 KB4.53
Callback_NSubstitute4,289.3 ns33.23 ns29.46 ns10.490.150.47300.00767.74 KB3.95
Callback_FakeItEasy4,741.8 ns67.17 ns59.54 ns11.600.200.41200.01536.81 KB3.47
Callback_Imposter397.7 ns5.54 ns4.33 ns0.970.020.14540.00102.38 KB1.22
Callback_TUnitMocks446.6 ns10.29 ns9.62 ns1.090.030.11350.00051.86 KB0.95

Sign up for freeto 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.

1 participant

@vbreuss