site/xunit.analyzers/rules/xUnit1008.md
This is triggered by forgetting to put the [Theory] attribute on a test method with data attributes.
If the test method does not have a [Theory] attribute on it, then the test will not run.
To fix a violation of this rule, either:
[Theory] attribute to the test methodusing Xunit;
public class xUnit1008
{
[InlineData(42)]
public void TestMethod(int _) { }
}
using Xunit;
public class xUnit1008
{
[Theory]
[InlineData(42)]
public void TestMethod(int _) { }
}
using Xunit;
public class xUnit1008
{
public void TestMethod(int _) { }
}
#pragma warning disable xUnit1008 // Test data attribute should only be used on a Theory
#pragma warning restore xUnit1008 // Test data attribute should only be used on a Theory