Description
When using the TUnit xUnit migration code fixer (TUXU0001), the fixer converts xUnit's Assert.All() to .AllSatisfy(), but this method doesn't exist on TUnit's collection assertions, resulting in CS1061 compilation errors.
Steps to Reproduce
- Create an xUnit test using
Assert.All():
using Xunit;
[Fact]
public void Test_All_Items()
{
var items = new[] { 1, 2, 3 };
Assert.All(items, item => Assert.True(item > 0));
}
- Install TUnit package and run
dotnet format analyzers --severity info --diagnostics TUXU0001
Expected Behavior
The code should be converted to valid TUnit syntax. If .AllSatisfy() doesn't exist, either:
- The method should be added to TUnit, or
- The fixer should convert to an existing TUnit pattern
Actual Behavior
The code is converted to:
[Test]
public async Task Test_All_Items()
{
var items = new[] { 1, 2, 3 };
await Assert.That(items).AllSatisfy(item => Assert.True(item > 0));
}
This causes:
error CS1061: 'CollectionAssertion<int>' does not contain a definition for 'AllSatisfy' and no accessible extension method 'AllSatisfy' accepting a first argument of type 'CollectionAssertion<int>' could be found
Affected Assertion Types
The issue affects multiple collection assertion types:
CollectionAssertion<T>
ReadOnlyListAssertion<T>
Impact
This affects tests that validate all items in a collection satisfy a condition. In the Moq test suite, this resulted in 28+ compilation errors.
Environment
- TUnit Version: 1.9.91
- .NET SDK: 10.0.101
- OS: Windows
Description
When using the TUnit xUnit migration code fixer (TUXU0001), the fixer converts xUnit's
Assert.All()to.AllSatisfy(), but this method doesn't exist on TUnit's collection assertions, resulting in CS1061 compilation errors.Steps to Reproduce
Assert.All():dotnet format analyzers --severity info --diagnostics TUXU0001Expected Behavior
The code should be converted to valid TUnit syntax. If
.AllSatisfy()doesn't exist, either:Actual Behavior
The code is converted to:
This causes:
Affected Assertion Types
The issue affects multiple collection assertion types:
CollectionAssertion<T>ReadOnlyListAssertion<T>Impact
This affects tests that validate all items in a collection satisfy a condition. In the Moq test suite, this resulted in 28+ compilation errors.
Environment