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
rowsIEnumerable<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
rowsReadOnlySpan<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
valuesReadOnlySpan<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
valuesIEnumerable<T>The candidate values for the column.
Returns
- CombinatorialTheoryDataBuilder
This builder.
Type Parameters
TThe 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
valuesReadOnlySpan<T>The candidate values for the column.
Returns
- CombinatorialTheoryDataBuilder
This builder.
Type Parameters
TThe 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
seedint?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
isTestCaseAllowedCombinatorialTheoryDataPredicateThe predicate to evaluate against completed generated rows.
Returns
- CombinatorialTheoryDataBuilder
This builder.