Method RecordException
- Namespace
- Xunit
- Assembly
- xunit.v3.assert.dll
RecordException(Action)
Records any exception which is thrown by the given code.
protected static Exception? RecordException(Action testCode)
Parameters
testCodeActionThe code which may thrown an exception.
Returns
- Exception
Returns the exception that was thrown by the code; null, otherwise.
RecordException(Func<object?>, string)
Records any exception which is thrown by the given code that has a return value. Generally used for testing property accessors.
protected static Exception? RecordException(Func<object?> testCode, string asyncMethodName)
Parameters
testCodeFunc<object>The code which may thrown an exception.
asyncMethodNamestringThe name of the async method the user should've called if they accidentally passed in an async function
Returns
- Exception
Returns the exception that was thrown by the code; null, otherwise.