示例#1
0
        public void Given_A_Test_With_A_Non_Critical_Assert_Step_With_Assert_Options_Defined_When_The_Test_Is_Executed_And_The_Assert_Fails_Then_The_Test_Fails()
        {
            using (new TestExecutionContext.IsolatedContext())
            {
                EndToEndTestJourney <TestContext>
                .When(_ => { })
                .Then(_ => Assert.That(1, Is.EqualTo(2)), AssertOptionsBuilder.RetryAssert(5, TimeSpan.Zero))
                .RunTest();

                Assert.That(TestExecutionContext.CurrentContext.CurrentResult.AssertionResults.Count, Is.EqualTo(1));
                Assert.That(TestExecutionContext.CurrentContext.CurrentResult.AssertionResults.Single().Status, Is.EqualTo(AssertionStatus.Failed));
                Assert.That(TestExecutionContext.CurrentContext.CurrentResult.FailCount, Is.EqualTo(1));
                Assert.That(TestExecutionContext.CurrentContext.CurrentResult.ResultState, Is.EqualTo(ResultState.Failure));
            }
        }
示例#2
0
        public void Given_A_Test_With_A_Non_Critical_Assert_Step_With_Assert_Options_Defined_When_The_Test_Is_Executed_And_The_Assert_Fails_Then_The_Assert_Is_Retried_The_Correct_Number_Of_Times()
        {
            int calls = 0;

            using (new TestExecutionContext.IsolatedContext())
            {
                EndToEndTestJourney <TestContext>
                .When(_ => { })
                .Then(_ =>
                {
                    calls++;
                    Assert.That(1, Is.EqualTo(2));
                }, AssertOptionsBuilder.RetryAssert(14, TimeSpan.Zero))
                .RunTest();
            }

            Assert.That(calls, Is.EqualTo(15));
        }