Even though both your testmethod
and TestCaseData
constructor take params
, TestCaseData
interprets params
differently: it tries to map them one-to-one to the parameters of the method being tested. In your case, NUnit expects a testmethod
with 12 parameters, but your method has only two. This causes the error that you see.
To fix this problem, you need to change the constructor call as follows:
yield return new TestCaseData(
"hello World"
, new[] {"h", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"}
);
Now you are passing only two arguments, the second one being an array that must be passed to your params String[] myList
.