Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

asserting exceptions c#

ExpectedException ex = Assert.Throws<ExpectedException>(() => methodToTest());
Assert.AreEqual( "Expected message text.", ex.Message );
Assert.AreEqual( 5, ex.SomeNumber);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #asserting #exceptions
ADD COMMENT
Topic
Name
3+2 =