Table of Contents

Class CombinatorialTheoryDataBuilder

Namespace
Xunit
Assembly
Xunit.Combinatorial.dll

Builds xUnit theory data from hand-authored base rows and generated columns.

public sealed class CombinatorialTheoryDataBuilder
Inheritance
CombinatorialTheoryDataBuilder
Inherited Members

Methods

AddRows(IEnumerable<IReadOnlyList<object?>>)

Adds complete hand-authored rows for the base columns.

public CombinatorialTheoryDataBuilder AddRows(IEnumerable<IReadOnlyList<object?>> rows)

Parameters

rows IEnumerable<IReadOnlyList<object>>

The rows to add. Every row must have the same width.

Returns

CombinatorialTheoryDataBuilder

This builder.

AddRows(params ReadOnlySpan<object?[]>)

Adds complete hand-authored rows for the base columns.

public CombinatorialTheoryDataBuilder AddRows(params ReadOnlySpan<object?[]> rows)

Parameters

rows ReadOnlySpan<object[]>

The rows to add. Every row must have the same width.

Returns

CombinatorialTheoryDataBuilder

This builder.

AddTestCase(params ReadOnlySpan<object?>)

Adds a complete hand-authored test case after the generated rows.

public CombinatorialTheoryDataBuilder AddTestCase(params ReadOnlySpan<object?> values)

Parameters

values ReadOnlySpan<object>

The values in the test case.

Returns

CombinatorialTheoryDataBuilder

This builder.

AddValues<T>(IEnumerable<T>)

Adds a generated column with the specified candidate values.

public CombinatorialTheoryDataBuilder AddValues<T>(IEnumerable<T> values)

Parameters

values IEnumerable<T>

The candidate values for the column.

Returns

CombinatorialTheoryDataBuilder

This builder.

Type Parameters

T

The type of values in the column.

AddValues<T>(params ReadOnlySpan<T>)

Adds a generated column with the specified candidate values.

public CombinatorialTheoryDataBuilder AddValues<T>(params ReadOnlySpan<T> values)

Parameters

values ReadOnlySpan<T>

The candidate values for the column.

Returns

CombinatorialTheoryDataBuilder

This builder.

Type Parameters

T

The type of values in the column.

BuildCombinations()

Builds every possible combination of the configured base rows and generated columns.

public IReadOnlyCollection<ITheoryDataRow> BuildCombinations()

Returns

IReadOnlyCollection<ITheoryDataRow>

The generated rows followed by explicitly added test cases.

BuildPairwiseCombinations(int?)

Builds rows that cover every possible pair across the configured base rows and generated columns.

public IReadOnlyCollection<ITheoryDataRow> BuildPairwiseCombinations(int? seed = null)

Parameters

seed int?

An optional seed used to vary the generated covering set. Omit for deterministic results.

Returns

IReadOnlyCollection<ITheoryDataRow>

The generated rows followed by explicitly added test cases.

Where(CombinatorialTheoryDataPredicate)

Adds a constraint that generated test cases must satisfy.

public CombinatorialTheoryDataBuilder Where(CombinatorialTheoryDataPredicate isTestCaseAllowed)

Parameters

isTestCaseAllowed CombinatorialTheoryDataPredicate

The predicate to evaluate against completed generated rows.

Returns

CombinatorialTheoryDataBuilder

This builder.