Table of Contents

Class CombinatorialTestCaseGenerator

Namespace
Xunit
Assembly
Xunit.Combinatorial.dll

Generates exhaustive, pairwise, and permutation test cases.

public static class CombinatorialTestCaseGenerator
Inheritance
CombinatorialTestCaseGenerator
Inherited Members

Methods

GenerateCombinations(ReadOnlySpan<int>, CombinatorialIndexPredicate?)

Generates every possible combination of value indices across the specified dimensions.

public static int[][] GenerateCombinations(ReadOnlySpan<int> dimensionSizes, CombinatorialIndexPredicate? isTestCaseAllowed = null)

Parameters

dimensionSizes ReadOnlySpan<int>

The number of candidate values in each dimension.

isTestCaseAllowed CombinatorialIndexPredicate

An optional predicate that rejects test cases.

Returns

int[][]

One test case per array, with one selected value index per dimension.

GeneratePairwiseCombinations(ReadOnlySpan<int>, CombinatorialIndexPredicate?, int?)

Generates test cases that cover every possible pair of value indices across the specified dimensions.

public static int[][] GeneratePairwiseCombinations(ReadOnlySpan<int> dimensionSizes, CombinatorialIndexPredicate? isTestCaseAllowed = null, int? seed = null)

Parameters

dimensionSizes ReadOnlySpan<int>

The number of candidate values in each dimension.

isTestCaseAllowed CombinatorialIndexPredicate

An optional predicate that rejects test cases.

seed int?

An optional seed used to vary the generated covering set. Omit to preserve the default deterministic result.

Returns

int[][]

One test case per array, with one selected value index per dimension.

GeneratePermutations<T>(ReadOnlySpan<T>)

Generates every permutation of the supplied values.

public static T[][] GeneratePermutations<T>(ReadOnlySpan<T> values)

Parameters

values ReadOnlySpan<T>

The values to permute.

Returns

T[][]

Every positional permutation of values.

Type Parameters

T

The type of value to permute.

Remarks

Input positions are treated as distinct, so equal input values may produce equal output rows.