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, unless the IsRequired parameter is set to 'false'.
For a list of all members of this type, see ExpectedExceptionAttribute Members.
System.Object
System.Attribute
csUnit.ExpectedExceptionAttribute
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
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
Assembly: csUnit (in csUnit.dll)
ExpectedExceptionAttribute Members | csUnit Namespace