void Ex04()
    {
        var thenStepCompleted = false;

        Given("async ThenStep that has an assertion with Exception that does not throw any exceptions", () =>
        {
            Step = FixtureSteps.CreateThenStep <ArgumentNullException>(async _ =>
            {
                await Task.Delay(100);
                thenStepCompleted = true;
            });
            ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, Step);
        });
        Given("async next ThenStep that asserts the Exception that is not thrown at WhenStep", () =>
        {
            NextStep = FixtureSteps.CreateThenStep <InvalidOperationException>(async _ =>
            {
                await Task.Delay(100);
            });
            ExpectedNextResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, NextStep);
        });
        When("the given ThenStep is run", () =>
        {
            Result = RunnerOf(Step).Run(StepResults).Build();
            StepResults.Add(Result);
        });
        Then("the given ThenStep should be awaited", () => thenStepCompleted);
        Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);

        When("the given next ThenStep is run", () => Result = RunnerOf(NextStep).Run(StepResults).Build());
        Then($"the result should be as follows:{ExpectedNextResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedNextResult);
    }
Example #2
0
 void Ex04()
 {
     Given("ThenStep that has an assertion with Exception that throws an exception", () =>
     {
         Step           = FixtureSteps.CreateThenStep(new Action <Exception>(exc => throw new Exception()));
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
Example #3
0
 void Ex02()
 {
     Given("ThenStep that has an assertion with Exception that returns false", () =>
     {
         Step           = FixtureSteps.CreateThenStep(exc => false);
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given ThenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
 void Ex02()
 {
     Given("GivenStep that has an arrangement that throws an exception", () =>
     {
         Step           = FixtureSteps.CreateGivenStep(() => throw new Exception());
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given GivenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
 void Ex02()
 {
     Given("WhenStep that has an action that is not completed within a time-out", () =>
     {
         Step           = FixtureSteps.CreateWhenStep(TimeSpan.FromMilliseconds(100), () => Thread.Sleep(200));
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given WhenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
 void Ex02()
 {
     Given("ThenStep that has tye type of an exception that is invalid", () =>
     {
         Step           = FixtureSteps.CreateThenStep <InvalidOperationException>();
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given ThenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
 void Ex04()
 {
     Given("async WhenStep that has an action that is not completed within a time-out", () =>
     {
         Step = FixtureSteps.CreateWhenStep(100, async() =>
         {
             await Task.Delay(200);
         });
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given WhenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
Example #8
0
 void Ex02()
 {
     Given("async ThenStep that has an assertion with Exception that throws an exception", () =>
     {
         Step = FixtureSteps.CreateThenStep(async _ =>
         {
             await Task.Delay(100);
             throw new Exception();
         });
         ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step);
     });
     When("the given ThenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }