Support of NUnit TestCase attribute with test method arguments


Statlight raises error:
System.Reflection.TargetParameterCountException: Parameter count mismatch.
when gets NUnit test method with TestCase attribute and several method parameters.
    [TestCase(null, typeof(ArgumentNullException), TestName = "NullCatalogName")]
    [TestCase("", typeof(ArgumentException), TestName = "EmptyCatalogName")]
    public static void TestInvalidArguments(string catalogName, Type expectedExceptionType)
Closed Nov 20, 2010 at 6:48 PM by staxmanade


staxmanade wrote Sep 25, 2010 at 7:45 AM

I understand this is a limitation of StatLight. I have some thoughts about how to implement this; however, it will take some effort. If you feel inclined to work on the feature, I'd be happy to share my thoughts on a possible implementation. If not, that's fine, but it may be some time before I get this implemented.

The Castle project ended up implementing it manually for each test. (since it's not supported yet)

staxmanade wrote Sep 27, 2010 at 3:17 AM

Turns out it wasn't all that difficult - but did take some time.

Please check out a solution in the following branch up at github. http://github.com/staxmanade/statlight/tree/NUnitTestCase

Let me know if you have any issues creating a build (over on the discussion board).

The solution does not fully supporting the TestCaseAttribute. It's currently supporting the Result, params of objects, and TestName properties of the attribute. I'm not currently supporting Ignore and expected exceptions at this point.

wrote Nov 20, 2010 at 6:48 PM

wrote Feb 14, 2013 at 8:18 PM

wrote May 16, 2013 at 9:50 AM