This is where the TestCaseSourceAttribute comes to the rescue.
First, define an object array containing your list of test cases. Next, invoke the test cases by referencing to the object array as the Test
's [TestCaseSource]
. This should build and run as you intended.
private static readonly object[] TestCases =
{
new SimpleDelegate[] { A, B, C },
new SimpleDelegate[] { C, A, B },
new SimpleDelegate[] { C, B, A }
};
[Test, TestCaseSource("TestCases")]
public void Test(SimpleDelegate action1, SimpleDelegate action2,
SimpleDelegate action3)
{
action1();
action2();
action3();
}
If you need a more complex argument list, you could for example use Tuple
instead of SimpleDelegate[]
to create strongly typed argument lists.