I have a testcase attribute with four arguments:
[TestCase("2007", "52", "saturday", "2007/12/29")]
The compiler says:
Arrays as attribute arguments is not CLS-compliant.
If I remove one argument, its works perfect. So, it's not clear to me why testcases with four attributes are not CLS-compliant. I'm using NUnit 3.5.
This is because, under the hood, NUnit's TestCaseAttribute actually has 4 different constructors.
As you can see - for 1-3 parameters, there are specific constructors, whereas for >3, it defaults to the non-CLS compliant version, which uses an
object[]instead. And as the compiler says, arrays as attribute arguments are not CLS compliant.If you need to be CLS compliant, you could get around this using a TestCaseSourceAttribute instead.