A test has the same data row twice, so one case runs twice and was probably meant to be another
What it finds
Two identical [InlineData], [TestCase] or [DataRow] rows on one test run the same case twice; usually one of them was copied and not edited. xUnit also refuses to list duplicate rows as separate tests.
From the rule's source, duplicate_test_data.rs.
using Xunit; public class Parsing{ [Theory] [InlineData("1")] [InlineData("2")] [InlineData("1")]tx0 reports: this data row repeats an earlier one public void Parses(string text) { }} 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:
[rules]
"tx0/csharp:duplicate-test-data" = "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:duplicate-test-data] reason="..."tx0 explain tx0/csharp:duplicate-test-data shows the same in the terminal. Found a false positive? Report it.