public void ChildClassWithoutLifeCycleShouldInheritLifeCycle() { var fixture = TestBuilder.MakeFixture(typeof(LifeCycleInheritedFixture)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifyInstancePerTestCase(2); }
public void InstancePerTestCaseShouldApplyToTheories() { var fixture = TestBuilder.MakeFixture(typeof(FixtureWithTheoryTest)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifyInstancePerTestCase(3); }
public void InstancePerTestCaseShouldApplyToParralelTests() { var fixture = TestBuilder.MakeFixture(typeof(ParallelLifeCycleFixtureInstancePerTestCase)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifyInstancePerTestCase(3); }
public void InstancePerTestCaseShouldApplyToTestFixtureSourceTests() { var fixture = TestBuilder.MakeFixture(typeof(LifeCycleWithTestFixtureSourceFixture)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); // TODO: OneTimeSetUpCount is called twice. Expected? Does seem consistent w/ reusing the class; then there are also two calls. BaseLifeCycle.VerifyInstancePerTestCase(4, 2); }
public void InstancePerTestCaseShouldApplyToRepeat() { RepeatingLifeCycleFixtureInstancePerTestCase.RepeatCounter = 0; var fixture = TestBuilder.MakeFixture(typeof(RepeatingLifeCycleFixtureInstancePerTestCase)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); Assert.AreEqual(3, RepeatingLifeCycleFixtureInstancePerTestCase.RepeatCounter); BaseLifeCycle.VerifyInstancePerTestCase(3); }
public void AssemblyLevelInstancePerTestCaseShouldCreateInstanceForEachTestCase() { var asm = TestAssemblyHelper.GenerateInMemoryAssembly( AssemblyLevelFixtureLifeCycleTest.Code, new[] { typeof(Test).Assembly.Location, typeof(BaseLifeCycle).Assembly.Location }); var testType = asm.GetType("FixtureUnderTest"); var fixture = TestBuilder.MakeFixture(testType); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifyInstancePerTestCase(2); }
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); }