I am making a unittest using the Nunit framework, and I am using the Combinatorial
attribute, allowing me to provide argument data.
I want to provide an int array that is within a range of 1-10
as argument data.
The test is written as follows:
[TestFixture]
public class TestClass
{
[Test]
[Combinatorial]
public void Test1(
[Values(Enumerable.Range(1,10).ToArray())] int x)
{
Console.WriteLine(x);
}
}
However, the Values
attribute gives me the following error:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
How do I create this constant int array, without having to type out all the individual numbers?