Skip to content

Commit

Permalink
Add test for FailWith with args (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
krajek authored and dennisdoomen committed Sep 19, 2018
1 parent 0f0cba5 commit 6c179a3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Tests/Shared.Specs/AssertionScopeSpecs.cs
Expand Up @@ -75,6 +75,34 @@ public void When_disposed_it_should_throw_any_failures()
}
}

[Fact]
public void When_disposed_it_should_throw_any_failures_and_properly_format_using_args()
{
//-----------------------------------------------------------------------------------------------------------
// Arrange
//-----------------------------------------------------------------------------------------------------------
var scope = new AssertionScope();

AssertionScope.Current.FailWith("Failure{0}", 1);

//-----------------------------------------------------------------------------------------------------------
// Act
//-----------------------------------------------------------------------------------------------------------
Action act = scope.Dispose;

//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
try
{
act();
}
catch (Exception exception)
{
exception.Message.Should().StartWith("Failure1");
}
}

[Fact]
public void When_multiple_scopes_are_nested_it_should_throw_all_failures_from_the_outer_scope()
{
Expand Down

0 comments on commit 6c179a3

Please sign in to comment.