void Ex02() { Filter.Accept(Arg.Any <FixtureDescriptor>()).Returns(true); var result = Container.Run(Filter, new FixtureStepRunnerFactory()); Expect( "all inner fixture methods should be called", () => TestFixtures.CalledFixtureMethods.Count == 3 && TestFixtures.CalledFixtureMethods.Contains(typeof(TestFixtures.SimpleFixture)) && TestFixtures.CalledFixtureMethods.Contains(typeof(TestFixtures.SimpleDisposableFixture)) && TestFixtures.CalledFixtureMethods.Contains(typeof(TestFixtures.SimpleFixtureSteppable)) ); ExpectedFixtureDescriptor = FixtureDescriptorWithBackgroundAssertion.Of("Simple Fixture", "SimpleFixture", "Carna.TestFixtures+SimpleFixture", typeof(ContextAttribute), "Simple Fixture Background"); Expect($"the descriptor of the result should be as follows:{ExpectedFixtureDescriptor.ToDescription()}", () => result != null && FixtureDescriptorWithBackgroundAssertion.Of(result.FixtureDescriptor) == ExpectedFixtureDescriptor); ExpectedFixtureResult = FixtureResultAssertion.ForNullException(true, true, true, 0, 3, FixtureStatus.Passed); Expect($"the result should be as follows:{ExpectedFixtureResult.ToDescription()}", () => result != null && FixtureResultAssertion.Of(result) == ExpectedFixtureResult); Expect("FixtureRunning event should be raised", () => FixtureRunningResult != null); ExpectedFixtureRunningDescriptor = FixtureDescriptorAssertion.Of("Simple Fixture", "SimpleFixture", "Carna.TestFixtures+SimpleFixture", typeof(ContextAttribute)); Expect($"the descriptor of the result on FixtureRunning should be as follows:{ExpectedFixtureRunningDescriptor.ToDescription()}", () => FixtureRunningResult != null && FixtureDescriptorAssertion.Of(FixtureRunningResult.FixtureDescriptor) == ExpectedFixtureRunningDescriptor); ExpectedFixtureRunningResult = FixtureResultAssertion.ForNullException(true, false, false, 0, 0, FixtureStatus.Running); Expect($"the result on FixtureRunning should be as follows:{ExpectedFixtureRunningResult.ToDescription()}", () => FixtureRunningResult != null && FixtureResultAssertion.Of(FixtureRunningResult) == ExpectedFixtureRunningResult); Expect("FixtureRun event should be raised", () => FixtureRunResult != null); Expect("the result on FixtureRun event should be the result that is returned by Run method", () => FixtureRunResult == result); }
IEnumerable ISampleDataSource.GetData() { yield return(new { Description = "", ContainerType = typeof(TestFixtures.SimpleFixture), ExpectedDescriptor = FixtureDescriptorWithBackgroundAssertion.Of( "Simple Fixture", "SimpleFixture", "Carna.TestFixtures+SimpleFixture", typeof(ContextAttribute), "Simple Fixture Background" ) }); yield return(new { Description = "", ContainerType = typeof(TestFixtures.SimpleFixtureWithBaseFixture), ExpectedDescriptor = FixtureDescriptorWithBackgroundAssertion.Of( "Simple Fixture that extends a base fixture to which Background attribute specifies", "SimpleFixtureWithBaseFixture", "Carna.TestFixtures+SimpleFixtureWithBaseFixture", typeof(ContextAttribute), @"Simple Fixture Background Simple Fixture with Base Fixture Background" ) }); }