Skip to content

refactor: migrate to TUnit - #223

Merged
vbreuss merged 6 commits into
mainfrom
topic/migrate-to-tunit
Mar 1, 2026
Merged

refactor: migrate to TUnit#223
vbreuss merged 6 commits into
mainfrom
topic/migrate-to-tunit

Conversation

@vbreuss

@vbreussvbreuss commented Nov 21, 2025

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 pre-release Stryker version that supports MTP

@vbreussvbreuss self-assigned this Nov 21, 2025
CopilotAI review requested due to automatic review settings November 21, 2025 08:19

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

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

Reviewed Changes

Copilot reviewed 94 out of 94 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
Tests/Mockolate.Tests/TestHelpers/Usings.csUpdated global using from Xunit to TUnit
Tests/Mockolate.Tests/TestHelpers/Record.csAdded Record helper class with Exception method for capturing exceptions
Tests/Mockolate.Tests/Verify/*.csMigrated test attributes from [Fact] to [Test] and [Theory]/[InlineData] to [Test]/[Arguments]
Tests/Mockolate.Tests/MockDelegates/DelegateTests.csUpdated assertions from xUnit Assert to aweXpect syntax
Tests/Mockolate.Tests/Mock*/*.csMigrated all test attributes to TUnit equivalents across all mock test files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actionsBot commented Nov 21, 2025

Copy link
Copy Markdown

Test Results

21 files ±0 21 suites ±0 21m 33s ⏱️ + 15m 54s
2 788 tests - 8 2 788 ✅ - 7 0 💤 - 1 0 ❌ ±0 
18 788 runs - 1 18 788 ✅ ±0 0 💤 - 1 0 ❌ ±0 

Results for commit aa90d42. ± Comparison against base commit bb36529.

♻️ This comment has been updated with latest results.

@github-actions

github-actionsBot commented Nov 21, 2025

Copy link
Copy Markdown

🚀 Benchmark Results

Details

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

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

MethodMeanErrorStdDevGen0Gen1Allocated
Simple_Mockolate1.516 μs0.0174 μs0.0163 μs0.2460-4.02 KB
Simple_Moq175.503 μs1.3583 μs1.2041 μs0.4883-14.55 KB
Simple_NSubstitute5.640 μs0.0165 μs0.0154 μs0.54930.00769.09 KB
Simple_FakeItEasy6.470 μs0.0138 μs0.0129 μs0.4959-8.11 KB
Simple_TUnitMocks2.263 μs0.0730 μs0.0683 μs0.40050.00766.55 KB

@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from f73fab0 to 37f8f6cCompareNovember 21, 2025 08:31
CopilotAI review requested due to automatic review settings November 21, 2025 13:05

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 96 out of 96 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CopilotAI review requested due to automatic review settings December 13, 2025 14:03
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from fb8ec75 to 2ad57d9CompareDecember 13, 2025 14:03

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 111 out of 111 changed files in this pull request and generated no new comments.

@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from fa2f047 to fc25794CompareDecember 28, 2025 14:35
CopilotAI review requested due to automatic review settings December 28, 2025 14:35

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 111 out of 111 changed files in this pull request and generated no new comments.

CopilotAI review requested due to automatic review settings December 28, 2025 15:07

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 111 out of 111 changed files in this pull request and generated no new comments.

@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from ade82c5 to 22a9fa3CompareFebruary 28, 2026 21:02
CopilotAI review requested due to automatic review settings February 28, 2026 21:11

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 148 out of 160 changed files in this pull request and generated 5 comments.

Comment threadPipeline/Build.UnitTest.cs Outdated
Comment threadTests/Mockolate.Tests/MatchTests.AnyParametersTests.cs
Comment threadTests/Mockolate.Analyzers.Tests/WrappabilityAnalyzerTests.cs
Comment threadTests/Directory.Build.props
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from 1267217 to 6657b44CompareFebruary 28, 2026 21:14
CopilotAI review requested due to automatic review settings February 28, 2026 21:20
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from 6657b44 to 0f59ad9CompareFebruary 28, 2026 21:20

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 150 out of 162 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

Source/Mockolate/Mockolate.csproj:15

  • Mockolate is described as supporting .NET Framework 4.8; if the library uses init accessors / records, IsExternalInit is typically also required for net48. Restricting this package to only netstandard2.0 can break compilation for the .NET Framework target. Consider expanding the condition to include net48 (or conditioning on $(TargetFrameworkIdentifier) for .NET Framework/non-.NET targets that need the polyfill).
	<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="IsExternalInit">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

Comment threadPipeline/Build.UnitTest.cs
Comment threadPipeline/Build.ApiChecks.cs Outdated
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from 0f59ad9 to 399022eCompareMarch 1, 2026 05:55

CopilotAI commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

@vbreuss I've opened a new pull request, #502, to work on those changes. Once the pull request is ready, I'll request review from you.

CopilotAI review requested due to automatic review settings March 1, 2026 06:29

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 151 out of 163 changed files in this pull request and generated 3 comments.

Comment threadPipeline/Build.UnitTest.cs
Comment threadPipeline/Build.ApiChecks.cs
Comment threadTests/Directory.Build.props
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from 841d121 to c23949bCompareMarch 1, 2026 06:37
CopilotAI review requested due to automatic review settings March 1, 2026 07:16
@vbreuss
vbreussforce-pushed the topic/migrate-to-tunit branch from c23949b to ce65eabCompareMarch 1, 2026 07:16

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 152 out of 164 changed files in this pull request and generated 1 comment.

Comment threadTests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs
CopilotAI review requested due to automatic review settings March 1, 2026 07:22

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 153 out of 165 changed files in this pull request and generated 4 comments.

Comment threadPipeline/Build.MutationTests.cs
Comment threadTests/Mockolate.SourceGenerators.Tests/GeneralTests.cs
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 3e0dab6 into mainMar 1, 2026
12 checks passed
@vbreuss
vbreuss deleted the topic/migrate-to-tunit branch March 1, 2026 07:40
vbreuss added a commit to vbreuss/TUnit that referenced this pull request Mar 1, 2026
I finally got the [CI-Build in Mockolate](Testably/Mockolate#223) to work with TUnit. The problem was, that the `--results-directory` is no custom CLI argument, but has to be specified before the `--` separator.
*Even though the error message is very misleading :(*
thomhurst pushed a commit to thomhurst/TUnit that referenced this pull request Mar 1, 2026
I finally got the [CI-Build in Mockolate](Testably/Mockolate#223) to work with TUnit. The problem was, that the `--results-directory` is no custom CLI argument, but has to be specified before the `--` separator.
*Even though the error message is very misleading :(*
vbreuss added a commit that referenced this pull request Mar 2, 2026
@vbreussvbreuss mentioned this pull request Mar 2, 2026
vbreuss added a commit that referenced this pull request Mar 2, 2026
This PR reverts the migration from xUnit to TUnit (done in PR #223), because mutation testing does not yet work with Microsoft Testing Platform (MTP) mode that TUnit uses.
@github-actions

Copy link
Copy Markdown

This is addressed in release v1.5.1.

@github-actionsgithub-actionsBot added the state: released The issue is released label Mar 2, 2026
@vbreussvbreuss mentioned this pull request Apr 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: releasedThe issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vbreuss