Skip to content

Fix xUnit Throws migration docs#5819

Merged
thomhurst merged 1 commit intomainfrom
fix-xunit-sync-throws-migration
May 2, 2026
Merged

Fix xUnit Throws migration docs#5819
thomhurst merged 1 commit intomainfrom
fix-xunit-sync-throws-migration

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • update xUnit migration docs so sync Assert.Throws<T>(Action) stays sync
  • add focused xUnit migration code-fix tests for sync Throws and async ThrowsAsync

Verification

  • dotnet exec "C:\Program Files\dotnet\sdk\10.0.203\MSBuild.dll" TUnit.Analyzers.Tests\TUnit.Analyzers.Tests.csproj /t:Build /p:Restore=false /v:minimal
  • dotnet TUnit.Analyzers.Tests\bin\Debug\net10.0\TUnit.Analyzers.Tests.dll --treenode-filter "/*/*/XUnitMigrationAnalyzerTests/Assert_Throws_Sync_Delegate_Stays_Sync"
  • dotnet TUnit.Analyzers.Tests\bin\Debug\net10.0\TUnit.Analyzers.Tests.dll --treenode-filter "/*/*/XUnitMigrationAnalyzerTests/Assert_ThrowsAsync_Async_Delegate_Stays_Async"

Closes #5817

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@thomhurst thomhurst merged commit ce4bcf6 into main May 2, 2026
13 of 15 checks passed
@thomhurst thomhurst deleted the fix-xunit-sync-throws-migration branch May 2, 2026 21:03
This was referenced May 2, 2026
github-actions Bot pushed a commit to IntelliTect/CodingGuidelines that referenced this pull request May 4, 2026
Updated [TUnit.Core](https://github.com/thomhurst/TUnit) from 1.40.10 to
1.43.11.

<details>
<summary>Release notes</summary>

_Sourced from [TUnit.Core's
releases](https://github.com/thomhurst/TUnit/releases)._

## 1.43.11

<!-- Release notes generated using configuration in .github/release.yml
at v1.43.11 -->

## What's Changed
### Other Changes
* perf(engine): skip execution ledger for independent tests by
@​thomhurst in thomhurst/TUnit#5813
* perf(engine): skip tracked object graph rediscovery by @​thomhurst in
thomhurst/TUnit#5814
* fix: suppress XML doc warnings in generated sources by @​mvanhorn in
thomhurst/TUnit#5797
* Fix xUnit Throws migration docs by @​thomhurst in
thomhurst/TUnit#5819
* Fix Should optional overload generation by @​thomhurst in
thomhurst/TUnit#5820
### Dependencies
* chore(deps): update dependency mockolate to 3.1.0 by @​thomhurst in
thomhurst/TUnit#5811
* chore(deps): update tunit to 1.43.2 by @​thomhurst in
thomhurst/TUnit#5809
* chore(deps): update dependency nunit.analyzers to 4.13.0 by
@​thomhurst in thomhurst/TUnit#5815
* chore(deps): update dependency yaml to v2.8.4 by @​thomhurst in
thomhurst/TUnit#5812

## New Contributors
* @​mvanhorn made their first contribution in
thomhurst/TUnit#5797

**Full Changelog**:
thomhurst/TUnit@v1.43.2...v1.43.11

## 1.43.2

<!-- Release notes generated using configuration in .github/release.yml
at v1.43.2 -->

## What's Changed
### Other Changes
* fix(assertions): emit auto-generated header in
MethodAssertionGenerator output by @​JohnVerheij in
thomhurst/TUnit#5796
* fix(engine): enforce runtime exclusion for global [NotInParallel]
(#​5800) by @​thomhurst in thomhurst/TUnit#5805
* feat(mocks): add Arg.AnyArgs() shortcut for setup/verify by
@​thomhurst in thomhurst/TUnit#5792
* fix(should): add specialized assertion sources by @​thomhurst in
thomhurst/TUnit#5806
### Dependencies
* chore(deps): update tunit to 1.41.0 by @​thomhurst in
thomhurst/TUnit#5789
* chore(deps): update microsoft.testing to 2.2.2 by @​thomhurst in
thomhurst/TUnit#5793
* chore(deps): update mstest to 4.2.2 by @​thomhurst in
thomhurst/TUnit#5794
* chore(deps): update docusaurus by @​thomhurst in
thomhurst/TUnit#5798
* chore(deps): update dependency dompurify to v3.4.2 by @​thomhurst in
thomhurst/TUnit#5799
* chore(deps): update dependency mockolate to v3 by @​thomhurst in
thomhurst/TUnit#5801


**Full Changelog**:
thomhurst/TUnit@v1.41.0...v1.43.2

## 1.41.0

<!-- Release notes generated using configuration in .github/release.yml
at v1.41.0 -->

## TUnit Should() Assertions (beta)
This versions comes with a beta version of TUnit.Assertions.Should -
meaning that you can do:
`myCode.Should().BeEqualTo(fluentShouldSyntax);`

For more information see the docs:
https://tunit.dev/docs/assertions/should-syntax

## What's Changed
### Other Changes
* fix(reporters): unwrap TestFailedException for failure grouping by
@​thomhurst in thomhurst/TUnit#5776
* Fix item-at Satisfies source typing by @​thomhurst in
thomhurst/TUnit#5764
* ci(docs): add link-check automation and tighten Docusaurus strictness
by @​thomhurst in thomhurst/TUnit#5779
* feat: add TUnit.Assertions.Should package by @​thomhurst in
thomhurst/TUnit#5785
### Dependencies
* chore(deps): update tunit to 1.40.10 by @​thomhurst in
thomhurst/TUnit#5775
* chore(deps): update actions/cache action to v5 by @​thomhurst in
thomhurst/TUnit#5780
* chore(deps): update dependency microsoft.net.test.sdk to 18.5.1 by
@​thomhurst in thomhurst/TUnit#5784


**Full Changelog**:
thomhurst/TUnit@v1.40.10...v1.41.0

Commits viewable in [compare
view](thomhurst/TUnit@v1.40.10...v1.43.11).
</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

[Bug]: The migration from xUnit’s Assert.Throws is incorrect

1 participant