An equality assertion gets the literal expected value as its second argument, so failures report expected and actual swapped

tx0/csharp:expected-value-secondrecommendedwarningmaintainability/designdepth fastsmell

What it finds

Assert.Equal and Assert.AreEqual take the expected value first and the actual value second, and their failure messages say so. With a literal in the second place, a failure reads "expected 42, actual 5" when the code produced 42. The rule reports a literal second argument when the first is not a literal.

From the rule's source, expected_value_second.rs.

Example from the rule's tests
using Xunit; public class Totals{    [Fact]    public void Sums()    {        int total = 2 + 2;        Assert.Equal(total, 4);tx0 reports: the expected value is passed second        Assert.Equal(4, total);    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:expected-value-second" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:expected-value-second] reason="..."

tx0 explain tx0/csharp:expected-value-second shows the same in the terminal. Found a false positive? Report it.