Take the test's cancellation token from TUnit's TestContext

Proprietary

Replace xUnit v3's TestContext.Current.CancellationToken with TUnit's TestContext.Current!.Execution.CancellationToken.

OpenRewrite.Recipes.CSharp.Migration.TUnit.FromXUnit.TestContextCancellationToken
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.TUnit.FromXUnit.TestContextCancellationToken

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.