Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Commit

Permalink
red: added ScenarioFeature.FeatureConstructionFails
Browse files Browse the repository at this point in the history
  • Loading branch information
adamralph committed Mar 26, 2015
1 parent 803166e commit 8431659
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/Xbehave.Test.Acceptance.Net40/ScenarioFeature.cs
Expand Up @@ -174,6 +174,19 @@ public void FeatureCannotBeConstructed()
.f(() => results.Should().ContainItemsAssignableTo<ITestFailed>());
}

[Scenario]
public void FeatureConstructionFails(Type feature, ITestFailed[] failures)
{
"Given a feature with a failing constructor"
.f(() => feature = typeof(FeatureWithAFailingConstructor));

"When I run the scenarios"
.f(() => failures = this.Run<ITestFailed>(feature));

"Then there should be one test failure"
.f(() => failures.Length.Should().Be(1));
}

[Scenario]
public void FailingStepThenPassingSteps()
{
Expand Down Expand Up @@ -344,6 +357,22 @@ public void Scenario()
}
}

private class FeatureWithAFailingConstructor
{
public FeatureWithAFailingConstructor()
{
throw new InvalidOperationException();
}

[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for testing.")]
[Scenario]
public void Scenario()
{
"Given something"
.f(() => { });
}
}

#if V2
private class FeatureWithAScenarioWithNoSteps
{
Expand Down

0 comments on commit 8431659

Please sign in to comment.