0

I have test like this:

[Test]
[TestCase(new RequestStatus?[] {RequestStatus.Created, null, RequestStatus.Complete, null})]
public void MyClass_MyMethod( RequestStatus?[] testCaseRequest )
{
  ...
}

Nuint doesn't recognise Nullable Array as TestCase param. I got this:

An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

Maqq
  • 1
  • 1
  • 1
    You might have to look at using `TestCaseSource`, as mentioned here : http://stackoverflow.com/questions/19479817/how-do-i-put-new-listint-1-in-an-nunit-testcase and here: http://stackoverflow.com/questions/10687091/passing-a-string-to-attribute-argument-by-calling-method – Jason Evans Dec 01 '14 at 08:58
  • I found answer here: http://stackoverflow.com/questions/19479817/how-do-i-put-new-listint-1-in-an-nunit-testcase – Maqq Dec 01 '14 at 09:15
  • Nice one :) Glad you've solved the problem. – Jason Evans Dec 01 '14 at 09:19

1 Answers1

0

You may use params as a method argument:

[TestCase(RequestStatus.Created, null, RequestStatus.Complete, null)]
public void MyClass_MyMethod(params RequestStatus?[] requestStatus)
{
    // ...
}
Dariusz Woźniak
  • 9,640
  • 6
  • 60
  • 73