nunit参数化测试中奇怪的构造函数行为
我有一个nunit 2.5.10参数化测试:nunit参数化测试中奇怪的构造函数行为,nunit,resharper,Nunit,Resharper,我有一个nunit 2.5.10参数化测试: [TestFixture(parameter1)] [TestFixture(parameter2)] public class MyTest : BaseTest { var param=""; public MyTest(string arg) { param=arg; } [Test] public Test() { //... test stuff
[TestFixture(parameter1)]
[TestFixture(parameter2)]
public class MyTest : BaseTest
{
var param="";
public MyTest(string arg)
{
param=arg;
}
[Test]
public Test()
{
//... test stuff
}
}
在使用Resharper 7.0.1的VS 12中,我只运行一个夹具,但是构造函数被调用两次——一次在测试执行之前(针对一个参数),然后在测试执行之后(针对另一个参数)。为什么?只有构造函数被调用了两次,测试本身按预期运行-只有一次。这是一个已知的问题,不幸的是,请参阅“在参数化TestFixture上调用特定案例时,所有案例构造函数和TestFixtureSetUp都被调用。”这在NUnit GUI中是否相同?