答案 0 :(得分:4)
创建一个参数化的测试夹具。传递有关哪个设置(可能是OneTimeSetUp)应该用于每个灯具实例的信息。信息必须是字符串之类的常量值,以便它可以用作属性的参数。
例如......
[TestFixture("setup1", 5)]
[TestFixture("setup2", 9)]
public class MyTestFixture
{
public MyTestFixture(string setup, int counter)
{
// You can save the arguments, or do something
// with them and save the result in instance members
}
[Test]
public void SomeTest()
{
// Do what you need to do, using the arguments
}
}