← Back to team overview

nunit-core team mailing list archive

[Bug 537914] Re: TheoryAttribute does not work with generics

 

That's understandable, because the Datapoints are required to exactly match the
argument type and double[,] is not an _exact_ match for T[,], even though it would
a proper match when calling the method. The problem is that there can never be
an exact match for this argument, since Datapoints will always be of some
particular type rather than generic.

I'm inclined not to support this. I'm at a loss to think of a good use case and it
seems to open up the possibility of a Theory that eats up any datapoint whatsoever,
like this one...

        [Theory]
        public void TestForAnythingWhatsoevery<T>(T theThing)
        {
             ...
        }

Can you explain why this is useful? I've also posted a question about it on the 
nunit-discuss list, so you can respond there if you're a member.

Charlie

** Changed in: nunitv2
       Status: Triaged => Confirmed

** Changed in: nunitv2
   Importance: High => Undecided

-- 
TheoryAttribute does not work with generics
https://bugs.launchpad.net/bugs/537914
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit V2 Test Framework: Confirmed

Bug description:
Setting: NUnit 2.5.3, Console runner, .NET 3.5

TheoryAttribute does not work with 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".





References