Assert.Catch

jnm2 edited this page Jun 14, 2017 · 5 revisions

Assert.Catch is similar to Assert.Throws but will pass for an exception that is derived from the one specified.

Exception Assert.Catch(TestDelegate code);
Exception Assert.Catch(TestDelegate code,
                       string message, params object[] parms);

Exception Assert.Catch(Type expectedExceptionType, TestDelegate code);
Exception Assert.Catch(Type expectedExceptionType, TestDelegate code,
                       string message, params object[] parms);

T Assert.Catch<T>(TestDelegate code);
T Assert.Catch<T>(TestDelegate code,
                  string message, params object[] parms);

See also...>

Clone this wiki locally
You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.