The value is not convertible to the method parameter type
This rule is triggered by having data in an [InlineData]
attribute which is not compatible with the parameter type.
Mismatched data vs. parameter type results in a runtime error where the test is not able to run.
To fix a violation of this rule, change either the data or the parameter type to match.
using Xunit;
public class xUnit1010
{
[Theory]
[InlineData("42")]
public void TestMethod(int _) { }
}
using Xunit;
public class xUnit1010
{
[Theory]
[InlineData("42")]
public void TestMethod(string _) { }
}
using Xunit;
public class xUnit1010
{
[Theory]
[InlineData(42)]
public void TestMethod(int _) { }
}