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
grahamrhay edited this page Feb 22, 2011
·
1 revision
#Throws
Matches if the block throws an exception of the expected type
[Test]publicvoidThrows(){Assert.That(()=>{thrownewArgumentNullException();},Throws.An<ArgumentNullException>());// with predicateAssert.That(()=>{thrownewArgumentNullException("message",newException());},Throws.An<ArgumentNullException>().With(e =>e.Message=="message"&&e.InnerException.GetType()==typeof(Exception)));}