Edit on GitHub

xUnit1002 Error

Test methods cannot have multiple Fact or Theory attributes

Cause

A test method has multiple Fact or Theory attributes.

Reason for rule

A test method only needs one Fact or Theory attribute.

How to fix violations

To fix a violation of this rule, remove all but one of the Fact or Theory attributes.

Examples

Violates

public class TestClass
{
    [Fact, Theory]
    public void TestMethod()
    {
    }
}

Does not violate

public class TestClass
{
    [Fact]
    public void TestMethod()
    {
    }
}
public class TestClass
{
    [Theory]
    public void TestMethod()
    {
    }
}
Copyright © 2017 .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit.analyzers.