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 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 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 Ex06() { FormattedDescription = Formatter.FormatFixture(new FixtureDescriptor(Name, new SpecificationAttribute(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 SpecificationAttribute", () => 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 Ex05() { FormattedDescription = Formatter.FormatFixture(new FixtureDescriptor(Name, new ScenarioAttribute(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 'Scenario: {the description of ScenarioAttribute}'", () => FormattedDescription.Lines.ElementAt(0) == $"Scenario: {Description}"); Expect("the line indent of the formatted description should be ' '(10 spaces)", () => FormattedDescription.LineIndent == " "); Expect("the items of the formatted description should be empty", () => !FormattedDescription.Items.Any()); }
void Ex04() { FormattedDescription = Formatter.FormatFixture(new FixtureDescriptor(Name, new StoryAttribute(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 StoryAttribute}'", () => FormattedDescription.Lines.ElementAt(0) == $"ストーリー:{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 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 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 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 Ex10() { var description = string.Empty; Given("the description that has three lines", () => description = @"Description line 1 Description line 2 Description line 3"); When("the description is formatted", () => FormattedDescription = Formatter.FormatFixture(new FixtureDescriptor(Name, new AssemblyFixtureAttribute(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) == "Assembly: 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"); }
/// <summary> /// Reports the title of the fixture with the specified description, level, and status. /// </summary> /// <param name="formattedDescription">The formatted description of the fixture.</param> /// <param name="level">The level of the fixture running result.</param> /// <param name="status">The status of the fixture running.</param> /// <returns>The next level of the specified fixture running result.</returns> protected virtual int ReportFixtureTitle(FormattedDescription formattedDescription, int level, FixtureStatus?status) { var indent = Indent(level); ReportValue(JoinFormattedLines(formattedDescription, indent), status, !status.HasValue); if (status.HasValue) { ReportStatus(status.Value, true); } if (formattedDescription.Items.IsEmpty()) { return(level + 1); } indent = Indent(level + 1); formattedDescription.Items.ForEach(item => ReportValue(JoinFormattedLines(item, indent), status, true)); return(level + 2); }
/// <summary> /// Joins formatted lines of the specified description with <see cref="Environment.NewLine"/> /// and the specified indent. /// </summary> /// <param name="description">The formatted description of the fixture.</param> /// <param name="indent">The indent of a line.</param> /// <returns> /// The string representation of the lines of a description that is joined /// with <see cref="Environment.NewLine"/> and the specified indent. /// </returns> protected virtual string JoinFormattedLines(FormattedDescription description, string indent) => description.JoinLines(indent);