Summary
Asserts that a delegate throws an exception of the Type
specified. If no exception is thrown or if it is of the
wrong Type, a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
Syntax
public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message = null, params object[] args)
Remarks
On success, this assertion returns the exception that
was thrown. This allows making further assertions on the
properties of the exception.
Parameters
| Name | Type | Description |
|---|---|---|
| expectedExceptionType | Type | The exception Type expected |
| code | TestDelegate | A TestDelegate |
| message | string | The message that will be displayed on failure |
| args | object[] | Arguments to be used in formatting the message |
Return Value
| Type | Description |
|---|---|
| Exception | The exception that was thrown |
