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 ChildClassWithLifeCycleShouldOverrideLifeCycle() { var fixture = TestBuilder.MakeFixture(typeof(LifeCycleInheritanceOverriddenFixture)); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifySingleInstance(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 BaseLifecycleFromOtherAssemblyShouldOverrideAssemblyLevelLifeCycle() { var asm = TestAssemblyHelper.GenerateInMemoryAssembly( InheritedOverrideTest.InheritClassWithOtherLifecycleFromOtherAssembly, 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.VerifySingleInstance(2); }
public void OuterFixtureLevelLifeCycleShouldOverrideAssemblyLevelLifeCycleInNestedFixture() { var asm = TestAssemblyHelper.GenerateInMemoryAssembly( NestedOverrideAssemblyLevelFixtureLifeCycleTest.OuterClass, new[] { typeof(Test).Assembly.Location, typeof(BaseLifeCycle).Assembly.Location }); var testType = asm.GetType("FixtureUnderTest+NestedFixture"); var fixture = TestBuilder.MakeFixture(testType); ITestResult result = TestBuilder.RunTest(fixture); Assert.That(result.ResultState.Status, Is.EqualTo(TestStatus.Passed)); BaseLifeCycle.VerifySingleInstance(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); }
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); }
public void SetUp() { BaseLifeCycle.Reset(); }