是否有针对xunit的参数化测试夹具?

Jer*_*lor 7 c# testing unit-testing xunit xunit.net

xunit.net是否支持像nunit这样的"参数化测试夹具"(参见下面的示例代码).注意我不是在寻找,IUseFixture<T>或者[Theory]因为它们没有提供与参数化测试夹具相同的功能

[TestFixture("hello", "hello", "goodbye")]
[TestFixture("zip", "zip")]
[TestFixture(42, 42, 99)]
public class ParameterizedTestFixture
{
    private string eq1;
    private string eq2;
    private string neq;

    public ParameterizedTestFixture(string eq1, string eq2, string neq)
    {
        this.eq1 = eq1;
        this.eq2 = eq2;
        this.neq = neq;
    }

    public ParameterizedTestFixture(string eq1, string eq2)
        : this(eq1, eq2, null) { }

    public ParameterizedTestFixture(int eq1, int eq2, int neq)
    {
        this.eq1 = eq1.ToString();
        this.eq2 = eq2.ToString();
        this.neq = neq.ToString();
    }

    [Test]
    public void TestEquality()
    {
        Assert.AreEqual(eq1, eq2);
        if (eq1 != null && eq2 != null)
            Assert.AreEqual(eq1.GetHashCode(), eq2.GetHashCode());
    }

    [Test]
    public void TestInequality()
    {
        Assert.AreNotEqual(eq1, neq);
        if (eq1 != null && neq != null)
            Assert.AreNotEqual(eq1.GetHashCode(), neq.GetHashCode());
    }
}
Run Code Online (Sandbox Code Playgroud)

fg_*_*rda 0

我只找到了这个项目:https ://github.com/vytautas-mackonis/xUnit.Paradigms 。仍然是 xUnit 1.9.2 版本。