Fact methods should not have test data
A fact method has one or more attributes that provide test data.
Unlike theory methods, fact methods do not have any parameters. Providing a fact method with test data is therefore pointless, as there is no way to actually pass that data to the test method.
To fix a violation of this rule, either:
Turn the fact method into a theory method by replacing [Fact]
with [Theory]
, if your test method is parameterized.
Remove any attributes that provide test data, if your test method is not parameterized. (That is, remove all attributes of a type deriving from DataAttribute
, such as [ClassData]
, [InlineData]
, or [MemberData]
.)
using Xunit;
public class xUnit1005
{
[Fact, InlineData(1)]
public void TestMethod()
{ }
}
using Xunit;
public class xUnit1005
{
[Fact]
public void TestMethod()
{ }
}
using Xunit;
public class xUnit1005
{
[Theory, InlineData(1)]
public void TestMethod(int _)
{ }
}