Skip to content

[Bug]: xUnit code fixer transposes arguments of Assert.Contains with lambda #4807

@ascott18

Description

@ascott18

Description

An xUnit assertion like Assert.Contains(collection, c => c.Name == "Foo"); is converted to await Assert.That(c => c.Name == "Foo").Contains(collection);, with the parameters backwards in the transformed assertion.

Expected Behavior

Assertion is transformed to await Assert.That(collection).Contains(c => c.Name == "Foo");

Actual Behavior

Assertion is transformed to await Assert.That(c => c.Name == "Foo").Contains(collection);

Steps to Reproduce

Run xUnit fixer on Assert.Contains(collection, c => c.Name == "Foo");

TUnit Version

1.14.0

.NET Version

.NET 10

Operating System

Windows

IDE / Test Runner

dotnet CLI (dotnet test / dotnet run)

Error Output / Stack Trace

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions