Beispiel #1
0
 public ThenStepRunnerSpec_StepRunningWithExceptionAsync()
 {
     StepResults = new FixtureStepResultCollection
     {
         FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(AssertedException).Build()
     };
 }
Beispiel #2
0
 void Ex02()
 {
     Given("GivenStep that has an arrangement that does not throw any exceptions", () => Step = FixtureSteps.CreateGivenStep(() => { }));
     Given("a result of ThenStep", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Passed().Build()));
     When("the given GivenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then("InvalidFixtureStepException should be thrown", exc => exc.GetType() == typeof(InvalidFixtureStepException));
 }
Beispiel #3
0
    /// <summary>
    /// Runs a Given step with the specified results of a fixture step.
    /// </summary>
    /// <param name="results">The results of the fixture step that was completed running.</param>
    /// <returns>The result of the Given step running.</returns>
    /// <exception cref="InvalidFixtureStepException">
    /// The <paramref name="results"/> does not have the <see cref="WhenStep"/> or the <see cref="ThenStep"/>.
    /// </exception>
    protected override FixtureStepResult.Builder Run(FixtureStepResultCollection results)
    {
        if (results.Has(typeof(WhenStep), typeof(ThenStep)))
        {
            throw new InvalidFixtureStepException("Given must be before When or Then");
        }

        if (IsPending)
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        if (results.HasExceptionAt <GivenStep>())
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        try
        {
            Step.Arrangement?.Invoke();
            Step.AsyncArrangement?.Invoke().GetAwaiter().GetResult();

            return(FixtureStepResult.Of(Step).Passed());
        }
        catch (Exception exc)
        {
            return(FixtureStepResult.Of(Step).Failed(exc));
        }
    }
Beispiel #4
0
 public ThenStepRunnerSpec_StepRunningWithoutException()
 {
     StepResults = new FixtureStepResultCollection
     {
         FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Passed().Build()
     };
 }
 public ThenStepRunnerSpec_StepRunningWithTypedException()
 {
     StepResults = new FixtureStepResultCollection
     {
         FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new ArgumentNullException()).Build()
     };
 }
Beispiel #6
0
    /// <summary>
    /// Runs a When step with the specified results of a fixture step.
    /// </summary>
    /// <param name="results">The results of the fixture step that was completed running.</param>
    /// <returns>The result of the When step running.</returns>
    protected override FixtureStepResult.Builder Run(FixtureStepResultCollection results)
    {
        if (IsPending)
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        if (results.HasExceptionAt <GivenStep>() || results.HasLatestExceptionAt <WhenStep>())
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAt <GivenStep>(FixtureStepStatus.Ready) || results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Ready))
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAt <GivenStep>(FixtureStepStatus.Pending) || results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Pending))
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        try
        {
            RunWhenStep();

            return(FixtureStepResult.Of(Step).Passed());
        }
        catch (Exception exc)
        {
            return(FixtureStepResult.Of(Step).Failed(exc));
        }
    }
Beispiel #7
0
 void Ex10()
 {
     Given("ThenStep that has an assertion with Exception that returns boolean", () => Step = FixtureSteps.CreateThenStep(new Action <Exception>(exc => throw new Exception())));
     Given("a result of GivenStep that does not have an exception", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Passed().Build()));
     Given("a result of WhenStep that has an exception", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new Exception()).Build()));
     When("the given ThenStep is run", () => RunnerOf(Step).Run(StepResults).Build());
     Then("the status of the result of the latest WhenStep should be Passed", () => StepResults.GetLatestStepResultsOf <WhenStep>().First().Status == FixtureStepStatus.Passed);
     Then("the exception of the result of the latest WhenStep should be null", () => StepResults.GetLatestStepResultsOf <WhenStep>().First().Exception == null);
 }
Beispiel #8
0
 void Ex03()
 {
     Given("GivenStep that has an arrangement that does not throw any exceptions", () =>
     {
         Step           = FixtureSteps.CreateGivenStep(() => { });
         ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Ready, Step);
     });
     Given("a result of GivenStep that has an exception", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Failed(new Exception()).Build()));
     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);
 }
Beispiel #9
0
 void Ex05()
 {
     Given("ExpectStep that has an assertion that returns true", () =>
     {
         Step           = FixtureSteps.CreateExpectStep(() => true);
         ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Ready, Step);
     });
     Given("a result of GivenStep that does not have Ready status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Passed().Build()));
     Given("a result of WhenStep that has Ready status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Ready().Build()));
     When("the given ExpectStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build());
     Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult);
 }
Beispiel #10
0
 void Ex13()
 {
     Given("ThenStep that has an assertion without Exception that returns true", () =>
     {
         Step           = FixtureSteps.CreateThenStep(() => true);
         ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Pending, Step);
     });
     Given("a result of GivenStep that has Passed status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Passed().Build()));
     Given("a result of WhenStep that has Pending status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Pending().Build()));
     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 Ex08()
 {
     Given("WhenStep that has an action that does not throw any exceptions", () =>
     {
         Step           = FixtureSteps.CreateWhenStep(() => { });
         ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Pending, Step);
     });
     Given("a result of GivenStep that has Passed status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Passed().Build()));
     Given("a result of WhenStep that has Pending status", () => StepResults.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Pending().Build()));
     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);
 }
Beispiel #12
0
 void Ex01()
 {
     When("the result of GivenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Build()));
     When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
     When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Build()));
     When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
     When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Build()));
     Then("the collection should not have the result of ExpectStep", () => !Results.Has(typeof(ExpectStep)));
     Then("the collection should have the result of GivenStep", () => Results.Has(typeof(GivenStep)));
     Then("the collection should have the result of WhenStep", () => Results.Has(typeof(WhenStep)));
     Then("the collection should have the result of ThenStep", () => Results.Has(typeof(ThenStep)));
     Then("the collection should have the result of GivenStep, WhenStep, and ThenStep", () => Results.Has(typeof(GivenStep), typeof(WhenStep), typeof(ThenStep)));
 }
Beispiel #13
0
    /// <summary>
    /// Runs a Then step with the specified results of a fixture step.
    /// </summary>
    /// <param name="results">The results of the fixture step that was completed running.</param>
    /// <returns>The result of the Then step running.</returns>
    /// <exception cref="InvalidFixtureStepException">
    /// The <paramref name="results"/> does not have the <see cref="WhenStep"/>.
    /// </exception>
    protected override FixtureStepResult.Builder Run(FixtureStepResultCollection results)
    {
        if (!results.Has(typeof(WhenStep)))
        {
            throw new InvalidFixtureStepException("Then must be after When.");
        }

        if (IsPending)
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        if (HasAssertionWithoutException && results.HasLatestExceptionAt <WhenStep>())
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Ready))
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Pending))
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        try
        {
            if (Step.Assertion is not null)
            {
                Step.ExecuteAssertion(Step.Assertion);
            }
            Step.Action?.Invoke();
            Step.AsyncAction?.Invoke().GetAwaiter().GetResult();

            if (HasAssertionWithException)
            {
                RunExceptionAssertion(results);
            }

            return(FixtureStepResult.Of(Step).Passed());
        }
        catch (Exception exc)
        {
            return(FixtureStepResult.Of(Step).Failed(exc));
        }
    }
Beispiel #14
0
    /// <summary>
    /// Reports the specified fixture step running result to the specified XML element.
    /// </summary>
    /// <param name="result">The fixture step running result.</param>
    /// <param name="element">The XML element to which the result is reported.</param>
    protected virtual void ReportFixtureStep(FixtureStepResult result, XElement element)
    {
        var stepElement = new XElement("step",
                                       new XAttribute("type", result.Step.GetType()),
                                       new XAttribute("description", result.Step.Description),
                                       new XAttribute("status", result.Status),
                                       new XAttribute("startTime", result.StartTime.GetValueOrDefault()),
                                       new XAttribute("endTime", result.EndTime.GetValueOrDefault()),
                                       new XAttribute("duration", result.Duration.GetValueOrDefault().TotalSeconds),
                                       new XAttribute("formattedDescription", FixtureFormatter.FormatFixtureStep(result.Step))
                                       );

        if (result.Exception is not null)
        {
            stepElement.Add(new XElement("exception", result.Exception));
        }

        element.Add(stepElement);
    }
Beispiel #15
0
 void Ex08()
 {
     When("the result of GivenStep that has a Ready status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Ready().Build()));
     When("the result of ExpectStep that has a Failed status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Failed(new Exception()).Build()));
     When("the result of WhenStep that has a Passed status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Passed().Build()));
     When("the result of WhenStep that has a Failed status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new Exception()).Build()));
     When("the result of WhenStep that has a Pending status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Pending().Build()));
     When("the result of ThenStep that has a Passed is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Passed().Build()));
     When("the result of ExpectStep that has a Ready status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Ready().Build()));
     When("the result of WhenStep that has a Ready status is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Ready().Build()));
     When("the result of ThenStep that has a Failed is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Failed(new Exception()).Build()));
     Then("the value that indicates whether the latest result of GivenStep has Ready status should be true", () => Results.HasStatusAtLatest <GivenStep>(FixtureStepStatus.Ready));
     Then("the value that indicates whether the latest result of GivenStep has Passed status should be false", () => !Results.HasStatusAtLatest <GivenStep>(FixtureStepStatus.Passed));
     Then("the value that indicates whether the latest result of WhenStep has Passed status should be false", () => !Results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Passed));
     Then("the value that indicates whether the latest result of WhenStep has Ready status should be true", () => Results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Ready));
     Then("the value that indicates whether the latest result of ThenStep has Failed status should be true", () => Results.HasStatusAtLatest <ThenStep>(FixtureStepStatus.Failed));
     Then("the value that indicates whether the latest result of ThenStep has Passed status should be false", () => !Results.HasStatusAtLatest <ThenStep>(FixtureStepStatus.Passed));
     Then("the value that indicates whether the latest result of ExpectStep has Failed should be false", () => !Results.HasStatusAtLatest <ExpectStep>(FixtureStepStatus.Failed));
     Then("the value that indicates whether the latest result of ExpectStep has Ready should be true", () => Results.HasStatusAtLatest <ExpectStep>(FixtureStepStatus.Ready));
 }
Beispiel #16
0
    /// <summary>
    /// Runs an Expect step with the specified results of a fixture step.
    /// </summary>
    /// <param name="results">The results of the fixture step that was completed running.</param>
    /// <returns>The result of the Expect step running.</returns>
    protected override FixtureStepResult.Builder Run(FixtureStepResultCollection results)
    {
        if (IsPending)
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        if (results.HasExceptionAt <GivenStep>() || results.HasLatestExceptionAt <WhenStep>())
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAt <GivenStep>(FixtureStepStatus.Ready) || results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Ready))
        {
            return(FixtureStepResult.Of(Step).Ready());
        }

        if (results.HasStatusAt <GivenStep>(FixtureStepStatus.Pending) || results.HasStatusAtLatest <WhenStep>(FixtureStepStatus.Pending))
        {
            return(FixtureStepResult.Of(Step).Pending());
        }

        try
        {
            if (Step.Assertion is not null)
            {
                Step.ExecuteAssertion(Step.Assertion);
            }
            Step.Action?.Invoke();
            Step.AsyncAction?.Invoke().GetAwaiter().GetResult();

            return(FixtureStepResult.Of(Step).Passed());
        }
        catch (Exception exc)
        {
            return(FixtureStepResult.Of(Step).Failed(exc));
        }
    }
Beispiel #17
0
    void Ex03()
    {
        When("the result of GivenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep("Given")).Build()));
        When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep("When 1")).Build()));
        When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep("When 2")).Build()));
        When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep("When 3")).Build()));
        When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep("Then 1")).Build()));
        When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep("Then 2")).Build()));
        When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep("When 4")).Build()));
        When("the result of WhenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep("When 5")).Build()));
        When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep("Then 3")).Build()));
        When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep("Then 4")).Build()));
        When("the result of ThenStep is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep("Then 5")).Build()));

        var latestGivenSteps = Results.GetLatestStepResultsOf <GivenStep>();

        Then("the count of the latest results of GivenStep should be 1", () => latestGivenSteps.Count() == 1);
        Then("the description of the latest result of GivenStep should be the specified description", () => latestGivenSteps.ElementAt(0).Step.Description == "Given");

        var latestWhenSteps = Results.GetLatestStepResultsOf <WhenStep>();

        Then("the count of the latest results of WhenStep should be 2", () => latestWhenSteps.Count() == 2);
        Then("the description of the latest result of WhenStep(1st) should be the specified description", () => latestWhenSteps.ElementAt(0).Step.Description == "When 5");
        Then("the description of the latest result of WhenStep(2nd) should be the specified description", () => latestWhenSteps.ElementAt(1).Step.Description == "When 4");

        var latestThenSteps = Results.GetLatestStepResultsOf <ThenStep>();

        Then("the count of the latest results of ThenStep should be 3", () => latestThenSteps.Count() == 3);
        Then("the description of the latest result of ThenStep(1st) should be the specified description", () => latestThenSteps.ElementAt(0).Step.Description == "Then 5");
        Then("the description of the latest result of ThenStep(2nd) should be the specified description", () => latestThenSteps.ElementAt(1).Step.Description == "Then 4");
        Then("the description of the latest result of ThenStep(3rd) should be the specified description", () => latestThenSteps.ElementAt(2).Step.Description == "Then 3");

        var latestExpectSteps = Results.GetLatestStepResultsOf <ExpectStep>();

        Then("the count of the latest results of ExpectStep should be 0", () => !latestExpectSteps.Any());
    }
Beispiel #18
0
 void Ex04()
 {
     When("the result of GivenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Build()));
     When("the result of ExpectStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Failed(new Exception()).Build()));
     When("the result of WhenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
     When("the result of WhenStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new Exception()).Build()));
     When("the result of WhenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
     When("the result of ThenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Build()));
     When("the result of ExpectStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Build()));
     Then("the value that indicates whether the latest result of GivenStep has an exception should be false", () => !Results.HasLatestExceptionAt <GivenStep>());
     Then("the value that indicates whether the latest result of WhenStep has an exception should be true", () => Results.HasLatestExceptionAt <WhenStep>());
     Then("the value that indicates whether the latest result of ThenStep has an exception should be false", () => !Results.HasLatestExceptionAt <ThenStep>());
     Then("the value that indicates whether the latest result of ExpectStep has an exception should be false", () => !Results.HasLatestExceptionAt <ExpectStep>());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixtureStepRunEventArgs"/> class
 /// with the specified fixture step running result.
 /// </summary>
 /// <param name="result">The fixture step running result.</param>
 public FixtureStepRunEventArgs(FixtureStepResult result)
 {
     Result = result;
 }
Beispiel #20
0
    void Ex06()
    {
        var targetException = new Exception();

        When("the result of GivenStep that has an exception that is not a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Failed(new Exception()).Build()));
        When("the result of ExpectStep that has a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Failed(targetException).Build()));
        When("the result of WhenStep that has a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(targetException).Build()));
        When("the result of WhenStep that has a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(targetException).Build()));
        When("the result of ThenStep that has an exception that is not a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Failed(new Exception()).Build()));
        When("the result of ThenStep that has an exception that is not a target exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Failed(new Exception()).Build()));
        When("the result of ExpectStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Passed().Build()));
        When("the collection clears the exception of the result the exception of which is equal to the target exception", () => Results.ClearException(targetException));
        Then("the exception of the result of GivenStep should not be cleared", () => Results.HasExceptionAt <GivenStep>());
        Then("all status of the result of GivenStep should not be Passed", () => Results.Where(r => r.Step.GetType() == typeof(GivenStep)).Any(r => r.Status != FixtureStepStatus.Passed));
        Then("the exception of the result of WhenStep should be cleared", () => !Results.HasExceptionAt <WhenStep>());
        Then("all status of the result of WhenStep should be Passed", () => Results.Where(r => r.Step.GetType() == typeof(WhenStep)).All(r => r.Status == FixtureStepStatus.Passed));
        Then("the exception of the result of ThenStep should not be cleared", () => Results.HasExceptionAt <ThenStep>());
        Then("all status of the result of GivenStep should not be Passed", () => Results.Where(r => r.Step.GetType() == typeof(ThenStep)).Any(r => r.Status != FixtureStepStatus.Passed));
        Then("the exception of the result of ExpectStep should be cleared", () => !Results.HasExceptionAt <ExpectStep>());
        Then("all status of the result of ExpectStep should be Passed", () => Results.Where(r => r.Step.GetType() == typeof(ExpectStep)).All(r => r.Status == FixtureStepStatus.Passed));
    }
Beispiel #21
0
    void Ex05()
    {
        var whenException = new Exception();
        var thenException = new Exception();

        When("the result of GivenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateGivenStep()).Build()));
        When("the result of ExpectStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Failed(new Exception()).Build()));
        When("the result of WhenStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new Exception()).Build()));
        When("the result of WhenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
        When("the result of WhenStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(whenException).Build()));
        When("the result of WhenStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Build()));
        When("the result of ThenStep that has an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateThenStep()).Failed(thenException).Build()));
        When("the result of ExpectStep that does not have an exception is added", () => Results.Add(FixtureStepResult.Of(FixtureSteps.CreateExpectStep()).Build()));
        Then("the exception of the latest result of GivenStep should be null", () => Results.GetLatestExceptionAt <GivenStep>() == null);
        Then("the exception of the latest result of WhenStep should be the specified last exception", () => Results.GetLatestExceptionAt <WhenStep>() == whenException);
        Then("the exception of the latest result of ThenStep should be the specified last exception", () => Results.GetLatestExceptionAt <ThenStep>() == thenException);
        Then("the exception of the latest result of ExpectStep should be null", () => Results.GetLatestExceptionAt <ExpectStep>() == null);
    }
Beispiel #22
0
 /// <summary>
 /// Runs a Note step with the specified results of a fixture step.
 /// </summary>
 /// <param name="results">The results of the fixture step that was completed running.</param>
 /// <returns>The result of the Note step running.</returns>
 protected override FixtureStepResult.Builder Run(FixtureStepResultCollection results)
 => FixtureStepResult.Of(Step).None();
Beispiel #23
0
 public FixtureStepResult.Builder Run(FixtureStepResultCollection results)
 {
     return(FixtureStepResult.Of(Step).Passed());
 }