public void InstancePerTestCaseCreatesAnInstanceForEachTestCase() { var fixture = TestBuilder.MakeFixture(typeof(CountingLifeCycleTestFixture)); var attr = new FixtureLifeCycleAttribute(LifeCycle.InstancePerTestCase); attr.ApplyToTest(fixture); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); }
public void SingleInstanceSharesAnInstanceForEachTestCase() { var fixture = TestBuilder.MakeFixture(typeof(CountingLifeCycleTestFixture)); var attr = new FixtureLifeCycleAttribute(LifeCycle.SingleInstance); attr.ApplyToTest(fixture); ITestResult result = TestBuilder.RunTest(fixture); Assert.That( result.Children.Select(t => t.ResultState), Is.EquivalentTo(new[] { ResultState.Success, ResultState.Failure })); }
public void InstancePerTestCaseFullLifeCycleTest() { BaseLifeCycle.Reset(); var fixture = TestBuilder.MakeFixture(typeof(FullLifecycleTestCase)); var attr = new FixtureLifeCycleAttribute(LifeCycle.InstancePerTestCase); attr.ApplyToTest(fixture); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed), result.Message); BaseLifeCycle.VerifyInstancePerTestCase(3); }
public void SingleInstanceFullLifeCycleTest() { BaseLifeCycle.Reset(); var fixture = TestBuilder.MakeFixture(typeof(FullLifecycleTestCase)); var attr = new FixtureLifeCycleAttribute(LifeCycle.SingleInstance); attr.ApplyToTest(fixture); ITestResult result = TestBuilder.RunTest(fixture); Assert.That( result.Children.Select(t => t.ResultState), Is.EquivalentTo(new[] { ResultState.Success, ResultState.Failure, ResultState.Failure })); BaseLifeCycle.VerifySingleInstance(3); }