using System;
using System.Collections;
using NUnit.Framework;
namespace Tests.MyTest
{
public class SpikeSuite
{
[Suite]
public static IEnumerable Suite
{
get
{
var suite = new ArrayList
{
new SpikeTest(),
};
return suite;
}
}
}
[TestFixture]
public class SpikeTest
{
[SetUp]
public void Setup()
{
Console.WriteLine("Test setup");
}
[TestFixtureSetUp]
public void FixtureSetup()
{
Console.WriteLine("Test fixture setup");
}
[Test]
public void TestMethod()
{
Console.WriteLine("Test method");
}
}
}
当我运行上述夹具时,我得到的输出是:
测试夹具设置
.测试设置
测试方法
测试夹具设置
.测试设置
测试方法
测试设置、夹具设置和测试方法被执行两次是怎么回事?