Last active
October 30, 2018 02:00
-
-
Save rpbeukes/dd9405514c15293ff1b9486c15882fe6 to your computer and use it in GitHub Desktop.
dotNetShouldlyShouldThrow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static TException ShouldThrow<TException>(Action action, string customMessage = null) where TException : Exception | |
{ | |
var ex = Should.Throw<Exception>(action, customMessage); | |
ex.ShouldBeOfType<TException>($"{ex.Message}{Environment.NewLine}StackTrace:{Environment.NewLine}{ex.StackTrace}"); | |
return (TException)ex; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment