<PackageReference Include="NUnit" Version="3.11.0" />

CombinatorialStrategy

CombinatorialStrategy creates test cases by using all possible combinations of the parameter data.
using NUnit.Framework.Interfaces; using System.Collections; using System.Collections.Generic; namespace NUnit.Framework.Internal.Builders { public class CombinatorialStrategy : ICombiningStrategy { public IEnumerable<ITestCaseData> GetTestCases(IEnumerable[] sources) { List<ITestCaseData> list = new List<ITestCaseData>(); IEnumerator[] array = new IEnumerator[sources.Length]; int num = -1; while (true) { if (++num < sources.Length) { array[num] = sources[num].GetEnumerator(); if (!array[num].MoveNext()) return list; } else { object[] array2 = new object[sources.Length]; for (int i = 0; i < sources.Length; i++) { array2[i] = array[i].Current; } TestCaseParameters item = new TestCaseParameters(array2); list.Add(item); num = sources.Length; while (--num >= 0 && !array[num].MoveNext()) { } if (num < 0) break; } } return list; } } }