Table of Contents

Namespace Xunit

Classes

AssemblyFixtureAttribute

Used to decorate xUnit.net test assemblies to indicate per-assembly fixture data. An instance of the fixture data is initialized before any test in the assembly are run (including InitializeAsync() if it's implemented). After all the tests in the assembly have been run, it is cleaned up by calling DisposeAsync() if it's implemented, or it falls back to Dispose() if that's implemented. Assembly fixtures must have a public parameterless constructor. To gain access to the fixture data from inside the test, a constructor argument should be added to the test class which exactly matches the fixture type.

CaptureConsoleAttribute

Captures Console output (Out and/or Error) and reports it to the test output helper.

CaptureTraceAttribute

Captures Trace and Debug output and reports it to the test output helper.

ClassDataAttribute

Provides a data source for a data theory, with the data coming from a class which must implement IEnumerable<object?[]>.

CollectionAttribute

Used to declare a specific test collection for a test class.

CollectionAttribute<TCollectionDefinition>

Used to declare a specific test collection for a test class. Equivalent to using CollectionAttribute with the type-based constructor.

CollectionBehaviorAttribute

Default implementation of ICollectionBehaviorAttribute.

CollectionDefinitionAttribute

Used to declare a test collection container class. The container class gives developers a place to attach interfaces like IClassFixture<TFixture> and ICollectionFixture<TFixture> that will be applied to all tests classes that are members of the test collection.

FactAttribute

Attribute that is applied to a method to indicate that it is a fact that should be run by the default test runner.

InlineDataAttribute

Provides a data source for a data theory, with the data coming from inline values.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>

Represents theory data which is created from the merging of ten data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>

Represents theory data which is created from the merging of eleven data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>

Represents theory data which is created from the merging of twelve data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>

Represents theory data which is created from the merging of thirteen data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>

Represents theory data which is created from the merging of fourteen data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>

Represents theory data which is created from the merging of fifteen data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2>

Represents theory data which is created from the merging of two data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3>

Represents theory data which is created from the merging of three data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4>

Represents theory data which is created from the merging of four data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5>

Represents theory data which is created from the merging of five data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6>

Represents theory data which is created from the merging of six data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7>

Represents theory data which is created from the merging of seven data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8>

Represents theory data which is created from the merging of eight data streams by creating a matrix of the data.

MatrixTheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9>

Represents theory data which is created from the merging of nine data streams by creating a matrix of the data.

MemberDataAttribute

Provides a data source for a data theory, with the data coming from one of the following sources:

  1. A public static property
  2. A public static field
  3. A public static method (with parameters)
Record

Allows the user to record actions for a test.

TestCaseOrdererAttribute

Used to decorate an assembly, test collection, or test class to allow the use of a custom test case orderer.

TestCollectionOrdererAttribute

Used to decorate an assembly to allow the use of a custom test collection orderer.

TestContext

Represents information about the current state of the test engine. It may be available at various points during the execution pipeline, so consumers must always take care to ensure that they check for null values from the various properties.

TestContextExtensions

Extension methods for ITestContext.

TestFrameworkAttribute

Used to decorate an assembly to allow the use of a custom test framework.

TestResultState

Represents information about the current state of a test after it has run.

TheoryAttribute

Marks a test method as being a data theory. Data theories are tests which are fed various bits of data from a data source, mapping to parameters on the test method. If the data source contains multiple rows, then the test method is executed multiple times (once with each data row). Data is provided by attributes which implement IDataAttribute (most commonly, InlineDataAttribute and MemberDataAttribute).

TheoryData

Represents an untyped set of data for a theory with an unknown number of parameters.

TheoryDataBase<TTheoryDataRow, TRawDataRow>

Provides a base type for theories based on collection initialization syntax.

TheoryDataRow

Implementation of ITheoryDataRow which accepts untyped pre-enumerated data.

TheoryDataRowBase

Provide a base implemention of ITheoryDataRow with settable properties and deferred data storage.

TheoryDataRowBaseExtensions

Extension methods for TheoryDataRowBase.

TheoryDataRow<T1>

Implementation of ITheoryDataRow which accepts one typed value.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>

Implementation of ITheoryDataRow which accepts ten typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>

Implementation of ITheoryDataRow which accepts eleven typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>

Implementation of ITheoryDataRow which accepts twelve typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>

Implementation of ITheoryDataRow which accepts thirteen typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>

Implementation of ITheoryDataRow which accepts fourteen typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>

Implementation of ITheoryDataRow which accepts fifteen typed values.

TheoryDataRow<T1, T2>

Implementation of ITheoryDataRow which accepts two typed values.

TheoryDataRow<T1, T2, T3>

Implementation of ITheoryDataRow which accepts three typed values.

TheoryDataRow<T1, T2, T3, T4>

Implementation of ITheoryDataRow which accepts four typed values.

TheoryDataRow<T1, T2, T3, T4, T5>

Implementation of ITheoryDataRow which accepts five typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6>

Implementation of ITheoryDataRow which accepts six typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7>

Implementation of ITheoryDataRow which accepts seven typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8>

Implementation of ITheoryDataRow which accepts eight typed values.

TheoryDataRow<T1, T2, T3, T4, T5, T6, T7, T8, T9>

Implementation of ITheoryDataRow which accepts nine typed values.

TheoryData<T>

Represents a set of data for a theory with one parameter. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>

Represents a set of data for a theory with ten parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>

Represents a set of data for a theory with eleven parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>

Represents a set of data for a theory with twelve parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>

Represents a set of data for a theory with thirteen parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>

Represents a set of data for a theory with fourteen parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>

Represents a set of data for a theory with fifteen parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2>

Represents a set of data for a theory with two parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3>

Represents a set of data for a theory with three parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4>

Represents a set of data for a theory with four parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5>

Represents a set of data for a theory with five parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6>

Represents a set of data for a theory with six parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7>

Represents a set of data for a theory with seven parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8>

Represents a set of data for a theory with eight parameters. Data can be added to the data set using the collection initializer syntax.

TheoryData<T1, T2, T3, T4, T5, T6, T7, T8, T9>

Represents a set of data for a theory with nine parameters. Data can be added to the data set using the collection initializer syntax.

TraitAttribute

Attribute used to decorate a test method, test class, or assembly with an arbitrary name/value pair ("trait").

Interfaces

IAsyncLifetime

Used to provide asynchronous lifetime functionality. Currently supported:

IClassFixture<TFixture>

Used to decorate xUnit.net test classes and collections to indicate a test which has per-test-class fixture data. An instance of the fixture data is initialized just before the first test in the class is run (including InitializeAsync() if it's implemented). After all the tests in the test class have been run, it is cleaned up by calling DisposeAsync() if it's implemented, or it falls back to Dispose() if that's implemented. Class fixtures may have a public constructor which is either empty, or accepts one or more assembly and/or collection fixture objects as constructor arguments. To gain access to the fixture data from inside the test, a constructor argument should be added to the test class which/ exactly matches the TFixture.

ICollectionFixture<TFixture>

Used to decorate xUnit.net test classes and collections to indicate a test which has per-test-collection fixture data. An instance of the fixture data is initialized just before the first test in the collection is run (including InitializeAsync() if it's implemented). After all the tests in the collection have been run, it is cleaned up by calling DisposeAsync() if it's implemented, or it falls back to Dispose() if that's implemented. Collection fixtures may have a public constructor which is either empty, or accepts one or more assembly fixture objects as constructor arguments. To gain access to the fixture data from inside the test, a constructor argument should be added to the test class which exactly matches the TFixture.

ITestContext

Represents the current state of the test pipeline.

ITestContextAccessor

Gives access to the current test context, which is considered to be an immutable snapshot of the current test state at the time it's retrieved.

ITestOutputHelper

Represents a class which can be used to provide test output.

ITheoryDataRow

Represents a single row of theory data, along with optional metadata attached to the row.

Enums

CollectionBehavior

Defines the built-in behavior types for collections in xUnit.net.

TestEngineStatus

Represents the current status of the execution of the test engine, with respect to a phase in the execution pipeline (for example, engine status for a test collection vs. test case vs. test).

TestPipelineStage

A flag to indicate which part of the test pipeline you're in. Retrieved from an instance of TestContext.

TestResult

Indicates the result of running the test.