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
dimensionSizesReadOnlySpan<int>The number of candidate values in each dimension.
isTestCaseAllowedCombinatorialIndexPredicateAn 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
dimensionSizesReadOnlySpan<int>The number of candidate values in each dimension.
isTestCaseAllowedCombinatorialIndexPredicateAn optional predicate that rejects test cases.
seedint?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
valuesReadOnlySpan<T>The values to permute.
Returns
- T[][]
Every positional permutation of
values.
Type Parameters
TThe type of value to permute.
Remarks
Input positions are treated as distinct, so equal input values may produce equal output rows.