Skip to content

Instantly share code, notes, and snippets.

@bitbonk
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitbonk/eb2766db5734e827d1ac to your computer and use it in GitHub Desktop.
Save bitbonk/eb2766db5734e827d1ac to your computer and use it in GitHub Desktop.
[Fact]
public void AssertNestedInnerException()
{
var expectedException = new Exception();
new Action(
() =>
{
throw new InvalidOperationException("", new KeyNotFoundException("", expectedExcpetion));
})
.ShouldThrow<InvalidOperationException>()
.WithInnerException<KeyNotFoundException>()
.WithInnerException<Exception>().Which.Should().Be(expectedExcpetion); // fails
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment