Using arrays of any dimension does not work in this example and ends up in the TestFixture failing to Set-up: (System.IndexOutOfRangeException trace)
static object[] populateTestCases = new object[]
{
new object[] { new int[40], 10}
};
[Test, TestCaseSource(nameof(populateTestCases))]
public void PopulateTest<T>(T[] array, T value)
{
foreach (var item in array)
Assert.AreEqual(item, value);
}
However using a List<T> works fine: (The test compiles and behaves properly)
static object[] populateTestCases = new object[]
{
new object[] { new List<int>(40), 10}
};
[Test, TestCaseSource(nameof(populateTestCases))]
public void PopulateTest<T>(List<T> array, T value)
{
foreach (var item in array)
Assert.AreEqual(item, value);
}
Using arrays of any dimension does not work in this example and ends up in the TestFixture failing to Set-up: (System.IndexOutOfRangeException trace)
However using a List<T> works fine: (The test compiles and behaves properly)