Table of Contents

Class TheoryDiscoverer

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

Implementation of IXunitTestCaseDiscoverer that supports finding test cases on methods decorated with ITheoryAttribute.

public class TheoryDiscoverer : IXunitTestCaseDiscoverer
Inheritance
TheoryDiscoverer
Implements
Inherited Members

Methods

CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions, IXunitTestMethod, ITheoryAttribute, ITheoryDataRow, object?[])

Creates test cases for a single row of data. By default, returns a single instance of XunitTestCase with the data row inside of it.

protected virtual ValueTask<IReadOnlyCollection<IXunitTestCase>> CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions discoveryOptions, IXunitTestMethod testMethod, ITheoryAttribute theoryAttribute, ITheoryDataRow dataRow, object?[] testMethodArguments)

Parameters

discoveryOptions ITestFrameworkDiscoveryOptions

The discovery options to be used.

testMethod IXunitTestMethod

The test method the test cases belong to.

theoryAttribute ITheoryAttribute

The theory attribute attached to the test method.

dataRow ITheoryDataRow

The data row that generated testMethodArguments.

testMethodArguments object[]

The arguments for the test method.

Returns

ValueTask<IReadOnlyCollection<IXunitTestCase>>

The test cases

CreateTestCasesForTheory(ITestFrameworkDiscoveryOptions, IXunitTestMethod, ITheoryAttribute)

Creates test cases for the entire theory. This is used when one or more of the theory data items are not serializable, or if the user has requested to skip theory pre-enumeration, or if the user has requested the entire theory be skipped. By default, returns a single instance of XunitDelayEnumeratedTheoryTestCase (which performs the data discovery at runtime, for non-skipped theories) or XunitTestCase (for skipped theories).

protected virtual ValueTask<IReadOnlyCollection<IXunitTestCase>> CreateTestCasesForTheory(ITestFrameworkDiscoveryOptions discoveryOptions, IXunitTestMethod testMethod, ITheoryAttribute theoryAttribute)

Parameters

discoveryOptions ITestFrameworkDiscoveryOptions

The discovery options to be used.

testMethod IXunitTestMethod

The test method the test cases belong to.

theoryAttribute ITheoryAttribute

The theory attribute attached to the test method.

Returns

ValueTask<IReadOnlyCollection<IXunitTestCase>>

The test case

Discover(ITestFrameworkDiscoveryOptions, IXunitTestMethod, IFactAttribute)

Discover test cases from a test method.

public virtual ValueTask<IReadOnlyCollection<IXunitTestCase>> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, IXunitTestMethod testMethod, IFactAttribute factAttribute)

Parameters

discoveryOptions ITestFrameworkDiscoveryOptions

The discovery options to be used.

testMethod IXunitTestMethod

The test method the test cases belong to.

factAttribute IFactAttribute

The theory attribute attached to the test method.

Returns

ValueTask<IReadOnlyCollection<IXunitTestCase>>

Returns zero or more test cases represented by the test method.

Remarks

This method performs the following steps: