We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Website makes no mention of how to assert when examples should throw, by using expect<>
The text was updated successfully, but these errors were encountered:
That should be documented, and also this: #59
class describe_something : nspec { SomeObject someObject; void a_context() { expect_an_exception( "it throws an exception", () => someObject.DoSomething(), ex => someObject.Flag.should_be(false)); expect_an_exception( "another test", () => someObject.DoSomethingElse(), ex => someObject.Flag.should_be(false)); } void expect_an_exception(string testName, Action actionThatThrows, Action<Exception> assertAfter) { it[testName] = () => { bool exceptionThrown = false; try { actionThatThrows(); } catch(Exception ex) { exceptionThrown = true; assertAfter(ex); } if(!exceptionThrown) throw new InvalidOperationException("exception was not thrown when expected"); }; } }
Sorry, something went wrong.
Closed by b9e0ec3 with both descriptions
expect
No branches or pull requests
Website makes no mention of how to assert when examples should throw, by using expect<>
The text was updated successfully, but these errors were encountered: