2011-09-19 82 views
1

是否有類似於Sequential Attribute的東西,我可以將其放在課程本身上。 並且在類級別上使用順序變量,而不是在特定的測試級別上,因爲它與Sequential Attribute一起使用。班級級別nunit的順序屬性

我只需要運行與我們使用的變量組合相關的TestFixtureSetUp。

感謝

回答

2

如何Parameterized Test Fixtures?您可以在您的TestFixture c'tor中傳遞參數列表,例如:

[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; 
    } 

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