Skip to content

Commit

Permalink
resolve merge on failFast test
Browse files Browse the repository at this point in the history
  • Loading branch information
GiuseppePiscopo committed May 19, 2017
2 parents 18db97d + 6b1e72a commit b5d53b0
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions sln/test/NSpec.Tests/WhenRunningSpecs/describe_fail_fast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void given_a_spec_with_multiple_failures()
};
}

void another_context()
void a_context_that_should_not_run()
{
it["does not run because of failure on line 20"] = () => Assert.That(true, Is.True);

Expand All @@ -49,23 +49,43 @@ public void should_skip()
[Test]
public void only_two_examples_are_executed_one_will_be_a_failure()
{
AllExamples().Where(s => s.HasRun).Count().Should().Be(2);
var expecteds = new[]
{
"this one isn't a failure",
"this one is a failure",
};

TheExample("this one isn't a failure").HasRun.Should().BeTrue();
var actuals = AllExamples().Where(e => e.HasRun).Select(e => e.Spec);

TheExample("this one is a failure").HasRun.Should().BeTrue();
actuals.ShouldBeEquivalentTo(expecteds);
}

[Test]
public void only_executed_examples_are_printed()
public void only_executed_contexts_are_printed()
{
formatter.WrittenContexts.First().Name.Should().Be("SpecClass");
var expecteds = new[]
{
"SpecClass",
"given a spec with multiple failures",
};

var actuals = formatter.WrittenContexts.Select(c => c.Name);

actuals.ShouldBeEquivalentTo(expecteds);
}

formatter.WrittenExamples.Count.Should().Be(2);
[Test]
public void only_executed_examples_are_printed()
{
var expecteds = new[]
{
"this one isn't a failure",
"this one is a failure",
};

formatter.WrittenExamples.First().FullName.Should().Contain("this one isn't a failure");
var actuals = formatter.WrittenExamples.Select(e => e.Spec);

formatter.WrittenExamples.Last().FullName.Should().Contain("this one is a failure");
actuals.ShouldBeEquivalentTo(expecteds);
}
}
}

0 comments on commit b5d53b0

Please sign in to comment.