public ThenStepRunnerSpec_StepRunningWithoutException() { StepResults = new FixtureStepResultCollection { FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Passed().Build() }; }
public ThenStepRunnerSpec_StepRunningWithExceptionAsync() { StepResults = new FixtureStepResultCollection { FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(AssertedException).Build() }; }
void Ex03() { 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 thrown at WhenStep", () => { NextStep = FixtureSteps.CreateThenStep <ArgumentNullException>(async _ => { await Task.Delay(100); thenStepCompleted = true; }); ExpectedNextResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, 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); thenStepCompleted = false; When("the given next ThenStep is run", () => Result = RunnerOf(NextStep).Run(StepResults).Build()); Then("the given next ThenStep should be awaited", () => thenStepCompleted); Then($"the result should be as follows:{ExpectedNextResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedNextResult); }
public ThenStepRunnerSpec_StepRunningWithTypedException() { StepResults = new FixtureStepResultCollection { FixtureStepResult.Of(FixtureSteps.CreateWhenStep()).Failed(new ArgumentNullException()).Build() }; }
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)); }
void Ex01() { Given("NoteStep", () => { Step = FixtureSteps.CreateNoteStep(); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.None, Step); }); When("the given NoteStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build()); Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult); }
void Ex02() { FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateWhenStep(Description)); Expect("the first line indent of the formatted description should be empty", () => FormattedDescription.FirstLineIndent == string.Empty); Expect("the line count of the formatted description should be 1", () => FormattedDescription.Lines.Count() == 1); Expect("the first element of the formatted description line should be the description of WhenStep", () => FormattedDescription.Lines.ElementAt(0) == Description); Expect("the line indent of the formatted description should be empty", () => FormattedDescription.LineIndent == string.Empty); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
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 Ex05() { FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateNoteStep(Description)); Expect("the first line indent of the formatted description should be empty", () => FormattedDescription.FirstLineIndent == string.Empty); Expect("the line count of the formatted description should be 1", () => FormattedDescription.Lines.Count() == 1); Expect("the first element of the formatted description line should be 'Note {the description of NoteStep}'", () => FormattedDescription.Lines.ElementAt(0) == $"Note {Description}"); Expect("the line indent of the formatted description should be ' '(5 spaces)", () => FormattedDescription.LineIndent == " "); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
void Ex03() { Given("GivenStep that does not have an arrangement", () => { Step = FixtureSteps.CreateGivenStep(); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Pending, 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 Ex03() { Given("ThenStep that has an assertion with Exception that does not throw any exception", () => { Step = FixtureSteps.CreateThenStep(exc => { }); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, 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() { FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateExpectStep(Description)); Expect("the first line indent of the formatted description should be empty", () => FormattedDescription.FirstLineIndent == string.Empty); Expect("the line count of the formatted description should be 1", () => FormattedDescription.Lines.Count() == 1); Expect("the first element of the formatted description line should be '期待値として、{the description of ExpectStep}'", () => FormattedDescription.Lines.ElementAt(0) == $"期待値として、{Description}"); Expect("the line indent of the formatted description should be ' '(7 spaces)", () => FormattedDescription.LineIndent == " "); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
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 Ex01() { Given("WhenStep that has an action that is completed within a time-out", () => { Step = FixtureSteps.CreateWhenStep(100, () => { }); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, 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("ExpectStep that has an assertion that returns true", () => { Step = FixtureSteps.CreateExpectStep(() => false); ExpectedResult = FixtureStepResultAssertion.ForNotNullException(FixtureStepStatus.Failed, Step); }); 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); }
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); }
void Ex10() { Formatter.FormatFixtureStep(FixtureSteps.CreateNoteStep(Description)); FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateNoteStep(Description)); Expect("the first line indent of the formatted description should be ' '(1 space)", () => FormattedDescription.FirstLineIndent == " "); Expect("the line count of the formatted description should be 1", () => FormattedDescription.Lines.Count() == 1); Expect("the first element of the formatted description line should be the description of NoteStep", () => FormattedDescription.Lines.ElementAt(0) == Description); Expect("the line indent of the formatted description should be ' '(1 space)", () => FormattedDescription.LineIndent == " "); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
void Ex06() { Formatter.FormatFixtureStep(FixtureSteps.CreateGivenStep(Description)); FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateGivenStep(Description)); Expect("the first line indent of the formatted description should be ' '(2 spaces)", () => FormattedDescription.FirstLineIndent == " "); Expect("the line count of the formatted description should be 1", () => FormattedDescription.Lines.Count() == 1); Expect("the first element of the formatted description line should be 'And {the description of GivenStep}'", () => FormattedDescription.Lines.ElementAt(0) == $"And {Description}"); Expect("the line indent of the formatted description should be ' '(6 spaces)", () => FormattedDescription.LineIndent == " "); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
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); }
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); }
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); }
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); }
void Ex01() { var givenStepCompleted = false; Given("async GivenStep that has an arrangement that does not throw any exceptions", () => { Step = FixtureSteps.CreateGivenStep(async() => { await Task.Delay(100); givenStepCompleted = true; }); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, Step); }); When("the given GivenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build()); Then("the given GivenStep should be awaited", () => givenStepCompleted); Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult); }
void Ex03() { var whenStepCompleted = false; Given("async WhenStep that has an action that is completed within a time-out", () => { Step = FixtureSteps.CreateWhenStep(100, async() => { await Task.Delay(50); whenStepCompleted = true; }); ExpectedResult = FixtureStepResultAssertion.ForNullException(FixtureStepStatus.Passed, Step); }); When("the given WhenStep is run", () => Result = RunnerOf(Step).Run(StepResults).Build()); Then("the given WhenStep should be awaited", () => whenStepCompleted); Then($"the result should be as follows:{ExpectedResult.ToDescription()}", () => FixtureStepResultAssertion.Of(Result) == ExpectedResult); }
void Ex11() { var description = string.Empty; Given("the description that has three lines", () => description = @"Description line 1 Description line 2 Description line 3"); When("Step is formatted", () => FormattedDescription = Formatter.FormatFixtureStep(FixtureSteps.CreateNoteStep(description))); Then("the line count of the formatted description should be 3", () => FormattedDescription.Lines.Count() == 3); Then("the first element of the formatted description line should be the first line of the given description", () => FormattedDescription.Lines.ElementAt(0) == "Note Description line 1"); Then("the second element of the formatted description line should be the second line of the given description", () => FormattedDescription.Lines.ElementAt(1) == "Description line 2"); Then("the third element of the formatted description line should be the third line of the given description", () => FormattedDescription.Lines.ElementAt(2) == "Description line 3"); }
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>()); }
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()); }
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))); }
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)); }