InlineData values must match the number of method parameters
This rule is triggered when you don’t have enough test data in your [InlineData]
attribute to match the number of parameters on your test method.
A theory which has insufficient data to cover all the tests will fail when you attempt to run it because of the missing data.
To fix a violation of this rule, you may:
[InlineData]
attributeusing Xunit;
public class xUnit1009
{
[Theory]
[InlineData("Hello world")]
public void TestMethod(string greeting, int age) { }
}
using Xunit;
public class xUnit1009
{
[Theory]
[InlineData("Hello world", 42)]
public void TestMethod(string greeting, int age) { }
}
using Xunit;
public class xUnit1009
{
[Theory]
[InlineData("Hello world")]
public void TestMethod(string greeting) { }
}
using Xunit;
public class xUnit1009
{
[Theory]
[InlineData("Hello world")]
public void TestMethod(string greeting, int age = 42) { }
}