When generating Tests with a StaticTestFactory in mbunit, the test suite needs to run only if a previous test passes. In the below code sample, The test Factory_ShouldNotRun_Test is executed even when the test it depends on fails.
The DependsOn atrtibute works with simple tests but not with a StaticTestFactory.
Any ideas? Thanks in advance.
public class Dependency_Test
{
[Test]
public void DependsOnMe_Test()
{
Assert.Fail("I fail and dependent tests should be skipped");
}
[Test]
[DependsOn("DependsOnMe_Test")]
public void Simple_Test_ShouldNotRun()
{
Assert.Fail("Simple test should not run");
}
[StaticTestFactory]
[DependsOn("DependsOnMe_Test")]
public static IEnumerable<Test> Factory_ShouldNotRun_Test()
{
var testCase = new TestCase("Factory_ShouldNotRun_Test", () =>
{
Assert.Fail("Factory test should not run");
});
yield return testCase;
}
}