创建单个参数化测试夹具。传递有关应将哪个设置(可能是 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
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1494 次 |
| 最近记录: |