Why does NUnit ignore datapoints when using generics in a theory

Posted by The Chairman on Stack Overflow See other posts from Stack Overflow or by The Chairman
Published on 2010-03-12T07:10:33Z Indexed on 2010/03/12 7:17 UTC
Read the original article Hit count: 805

Filed under:
|
|

I'm trying to make use of the TheoryAttribute, introduced in NUnit 2.5. Everything works fine as long as the arguments are of a defined type:

[Datapoint]
public double[,] Array2X2 = new double[,] { { 1, 0 }, { 0, 1 } };

[Theory]
public void TestForArbitraryArray(double[,] array)
{
  // ...
}

It does not work, when I use generics:

[Datapoint]
public double[,] Array2X2 = new double[,] { { 1, 0 }, { 0, 1 } };

[Theory]
public void TestForArbitraryArray<T>(T[,] array)
{
  // ...
}

NUnit gives a warning saying No arguments were provided. Why is that?

© Stack Overflow or respective owner

Related posts about nunit

Related posts about generics