mercredi 1 avril 2015

Unable to pass string array, NUnit Test

Folks,


Like many of you , I want to pass different test parameters using NUnit Test.


I can pass integer array, no problem, but when I pass string array it does not work.



[TestCase(
new[] {"ACCOUNT", "SOCIAL"})]
public void Get_Test_Result(string[] contactTypes)
{ ... }



Error 3 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type ... \ContactControllerTests.cs 78 13 UnitTests



It works when I use string array as a second argument.



[TestCase(0,
new[] {"ACCOUNT", "SOCIAL"})]
public void Get_Test_Result(int dummyNumber, string[] contactTypes)
{ ... }


So what is the reason?


Aucun commentaire:

Enregistrer un commentaire