public void Should_execute_tests_with_shared_context()
 {
     _subject.RunScenario <CustomContext>(
         Given_shared_value_is_5,
         Then_shared_value_is_passed_to_second_step_and_still_match_5);
 }
 public void Should_capture_execution_time_for_simplified_steps()
 {
     AssertScenarioExecutionTime(() => _subject.RunScenario(Step_one, Step_two));
 }
Пример #3
0
        public void Should_collect_scenario_result_for_parameterized_steps()
        {
            _subject.RunScenario(
                given => Product_is_available_in_product_storage("wooden desk"),
                when => Customer_orders_this_product(),
                then => Customer_receives_invoice_for_product_in_amount_pounds("wooden desk", 62),
                then => Product_is_sent_to_customer());

            var result = _subject.Result.Scenarios.Single();

            Assert.That(result.Name, Is.EqualTo("Should collect scenario result for parameterized steps"));
            Assert.That(result.Status, Is.EqualTo(ResultStatus.Passed));
            Assert.That(result.Label, Is.EqualTo("LABEL-57"));
            StepResultExpectation.Assert(result.Steps, new[]
            {
                new StepResultExpectation(1, "GIVEN Product \"wooden desk\" is available in product storage", ResultStatus.Passed),
                new StepResultExpectation(2, "WHEN Customer orders this product", ResultStatus.Passed),
                new StepResultExpectation(3, "THEN Customer receives invoice for product \"wooden desk\" in amount \"62\" pounds", ResultStatus.Passed),
                new StepResultExpectation(4, "THEN Product is sent to customer", ResultStatus.Passed)
            });
        }
Пример #4
0
        public void It_should_collect_scenario_result()
        {
            _subject.RunScenario(Step_one, Step_two);
            var result = _subject.Result.Scenarios.Single();

            Assert.That(result.Name, Is.EqualTo("It should collect scenario result"));
            Assert.That(result.Status, Is.EqualTo(ResultStatus.Passed));
            Assert.That(result.Categories, Is.Empty);

            StepResultExpectation.Assert(result.Steps, new[]
            {
                new StepResultExpectation(1, "Step one", ResultStatus.Passed),
                new StepResultExpectation(2, "Step two", ResultStatus.Passed)
            });
        }
Пример #5
0
        public void Should_display_scenario_failure()
        {
            var ex = Assert.Throws <InvalidOperationException>(() => _subject.RunScenario(Step_throwing_exception));

            _progressNotifier.AssertWasCalled(n => n.NotifyScenarioFinished(Arg <IScenarioResult> .Matches(r => r.Status == ResultStatus.Failed && r.StatusDetails == "Step 1: " + ex.Message)));
        }
Пример #6
0
        public void Should_collect_scenario_result()
        {
            _subject.RunScenario(Step_one, Step_two);
            var result = _subject.Result.Scenarios.Single();

            Assert.That(result.Name, Is.EqualTo("Should collect scenario result"));
            Assert.That(result.Status, Is.EqualTo(ResultStatus.Passed));
            Assert.That(result.Steps, Is.EqualTo(new[]
            {
                new StepResult(1, "Step one", ResultStatus.Passed),
                new StepResult(2, "Step two", ResultStatus.Passed)
            }));
        }