Show / Hide Table of Contents

Class Record

Allows the user to record actions for a test.

Inheritance
Object
Record
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public class Record : object

Methods

| Improve this Doc View Source

Exception(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

Exception(Func<Task>)

Declaration
public static Exception Exception(Func<Task> testCode)
Parameters
Type Name Description
Func<Task> testCode
Returns
Type Description
Exception
| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX