Example #1
0
 public async Task Xunit_Assert_in_async_step_action()
 {
     var scenario = TestScenarioFactory.Default();
     await Assert.ThrowsAsync <TrueException>(async() =>
                                              await scenario.Step("I am assert which should fail", async() => {
         await Task.Delay(1);
         _AssertAction();
     }));
 }
Example #2
0
        public async Task should_present_basic_scenario()
        {
            var scenario = TestScenarioFactory.Default();

            await scenario.Step("This is the first step", () =>
            {
                // Here comes the logic
            });

            await scenario.Step("This is the second step", () =>
            {
                // Here comes the logic
            });

            await scenario.Step("This is the third step", () =>
            {
                // Here comes the logic
            });
        }
Example #3
0
        public async Task should_present_scenario_with_sub_steps()
        {
            var scenario = TestScenarioFactory.Default();

            await scenario.Step("This is the first step", async() =>
            {
                await scenario.Step("This is the first sub-step of first step", () =>
                {
                    // Here comes the logic
                });
                await scenario.Step("This is the second sub-step of first step", () =>
                {
                    // Here comes the logic
                });
            });

            await PerformReusableScenarioPart(scenario);

            await scenario.Step("This is the third step", () =>
            {
                // Here comes the logic
            });
        }
Example #4
0
        public async Task should_present_basic_scenario_with_steps_returning_value()
        {
            var scenario = TestScenarioFactory.Default();

            var valFromStep1 = await scenario.Step("This is the first step", () =>
            {
                // Here comes the logic
                return(1);
            });

            var valFromStep2 = await scenario.Step("This is the second step", async() =>
            {
                // Here comes the logic
                await Task.Yield();
                return(valFromStep1 + 1);
            });

            await scenario.Step("This is the third step", () =>
            {
                // Here comes the logic
                _ = valFromStep1 + valFromStep2;
            });
        }