public void GetPermutations() { // arrange InvariantDictionary <InvariantHashSet> values = new InvariantDictionary <InvariantHashSet> { ["a"] = new InvariantHashSet { "a1", "a2", "a3" }, ["b"] = new InvariantHashSet { "b1", "b2", "b3" }, ["c"] = new InvariantHashSet { "c1", "c2", "c3" } }; // act IEnumerable <InvariantDictionary <string> > permutations = new ConditionFactory().GetPermutations(values); // assert IEnumerable <string> actual = permutations.Select(permutation => "(" + this.SortAndCommaDelimit(permutation.Values.OrderBy(p => p)) + ")"); IList <string> expected = new List <string>(); for (int a = 1; a <= 3; a++) { for (int b = 1; b <= 3; b++) { for (int c = 1; c <= 3; c++) { expected.Add($"(a{a}, b{b}, c{c})"); } } } this.SortAndCommaDelimit(actual).Should().Be(this.SortAndCommaDelimit(expected)); }