The ExpectedExceptionAttribute can be used to mark a test, so that when no exception of a particular type has been thrown, the test will be reported as failed. Only if the exact exception type has been thrown, the test will pass.
For a list of all members of this type, see ExpectedExceptionAttribute Members.
In most cases it is sufficient to just check for a particular type of exception. However, sometimes you would like to make sure that the thrown exception object is equal to a predefined exception object. For instance, if you expect that the thrown exception has a predefined value for its message property. In this case, you can use the second constructor taking an exception object instead of a type.
Namespace: csUnit Namespace