NUnit Test with an array of values
You can use FactoryAttribute
on test method, instead of ValuesAttribute
on param. Read more about this here.
Edit: Alexander is right. FactoryAttribute was a temporary part of API. The right path is to use TestCaseSourceAttribute.
TestCaseSource
attribute is suitable here.
See example:
private string[] commonCases = { "Val1", "Val2", "Val3" };
[Test]
[TestCaseSource(nameof(commonCases))]
public void Test1(string value)
{
....
}
[Test]
[TestCaseSource(nameof(commonCases))]
public void Test12(string value)
{
....
}