A data row of a test has a different number of values than the test has parameters
What it finds
[InlineData], [TestCase] and [DataRow] pass their values to the test's parameters in order. A row with more or fewer values than there are parameters fails at run time, and the case it was meant to test is never checked. Methods with a params array or optional parameters, and rows with named properties such as Skip =, are left alone.
From the rule's source, test_data_arity.rs.
using Xunit; public class Ranges{ [Theory] [InlineData(1, 2)] [InlineData(3)]tx0 reports: InlineData passes 1 value(s) to a test with 2 parameter(s) public void Within(int low, int high) { } [Theory] [InlineData(1, 2, 3)] public void Many(params int[] values) { }} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/csharp:test-data-arity" = "off"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:test-data-arity] reason="..."tx0 explain tx0/csharp:test-data-arity shows the same in the terminal. Found a false positive? Report it.