AArnott / Xunit.Combinatorial

Adds combinatorial and pairwise testing capability to Xunit tests
Other
180 stars 16 forks source link

Add an attribute for all possible permutations of values in an array #85

Open DoctorKrolic opened 1 year ago

DoctorKrolic commented 1 year ago

Example:

[Theory, CombinatorialData]
public void Example([CombinatorialPermutations(new int[] { 1, 2, 3 })] int[] values)
{
    // 1 2 3
    // 1 3 2
    // 2 1 3
    // 2 3 1
    // 3 1 2
    // 3 2 1
}

Same with other types, e.g. strings:

[Theory, CombinatorialData]
public void Example([CombinatorialPermutations(new string[] { "a", "b", "c" })] string[] values)
{
    // "a" "b" "c"
    // "a" "c" "b"
    // "b" "a" "c"
    // "b" "c" "a"
    // "c" "a" "b"
    // "c" "b" "a"
}