You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classdescribe_something:nspec{SomeObjectsomeObject;voida_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));}voidexpect_an_exception(stringtestName,ActionactionThatThrows,Action<Exception>assertAfter){it[testName]=()=>{boolexceptionThrown=false;try{actionThatThrows();}catch(Exceptionex){exceptionThrown=true;assertAfter(ex);}if(!exceptionThrown)thrownewInvalidOperationException("exception was not thrown when expected");};}}
Activity
amirrajan commentedon Feb 25, 2017
That should be documented, and also this: #59
BrainCrumbz commentedon Mar 6, 2017
Closed by b9e0ec3 with both descriptions