Class Record
Allows the user to record actions for a test.
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public class Record : object
Methods
| Improve this Doc View SourceException(Action)
Records any exception which is thrown by the given code.
Declaration
public static Exception Exception(Action testCode)
Parameters
Type | Name | Description |
---|---|---|
Action | testCode | The code which may throw an exception. |
Returns
Type | Description |
---|---|
Exception | Returns the exception that was thrown by the code; null, otherwise. |
Exception(Func<Object>)
Records any exception which is thrown by the given code that has a return value. Generally used for testing property accessors.
Declaration
public static Exception Exception(Func<object> testCode)
Parameters
Type | Name | Description |
---|---|---|
Func<Object> | testCode | The code which may throw an exception. |
Returns
Type | Description |
---|---|
Exception | Returns the exception that was thrown by the code; null, otherwise. |
Exception(Func<Task>)
Declaration
public static Exception Exception(Func<Task> testCode)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | testCode |
Returns
Type | Description |
---|---|
Exception |
ExceptionAsync(Func<Task>)
Records any exception which is thrown by the given task.
Declaration
public static Task<Exception> ExceptionAsync(Func<Task> testCode)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | testCode | The task which may throw an exception. |
Returns
Type | Description |
---|---|
Task<Exception> | Returns the exception that was thrown by the code; null, otherwise. |