Edit on GitHub

xUnit1011   v2 v3   Error

There is no matching method parameter

Cause

This rule is triggered when you have more test data in your [InlineData] attribute then parameters on your test method.

Reason for rule

Having excess test data will cause the theory to fail at runtime.

How to fix violations

To fix a violation of this rule, you may:

Examples

Violates

using Xunit;

public class xUnit1011
{
    [Theory]
    [InlineData("Hello world", 42)]
    public void TestMethod(string greeting) { }
}

Does not violate

using Xunit;

public class xUnit1011
{
    [Theory]
    [InlineData("Hello world")]
    public void TestMethod(string greeting) { }
}
using Xunit;

public class xUnit1011
{
    [Theory]
    [InlineData("Hello world", 42)]
    public void TestMethod(string greeting, int age) { }
}
Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.