Not all tests are run in parameterised NUnit TestFixture containing arrays

c#, nunit, parameterized, resharper, testing

Solution

[TestFixture("someurl1", "param1|param2", 15)]
[TestFixture("someurl2", "param3", 15)]
public class my_test
{
    private string[] _fields;

    public my_test(string url, string fieldList, int someVal)
    {
        _fields = fieldList.Split('|');
        // test setup
    }

    [Test]
    public void listFields()
    {
        foreach (var field in _fields)
        {
            Console.WriteLine(field);
        }
    }
}

Problem

I have a test class as follows: ``` [TestFixture("someurl1", new[] { "param1", "param2" }, 15)] [TestFixture("someurl2", new[] { "param3" }, 15)] public class my_test { public my_test(string url, string[] fields, int someVal) { // test setup } } ``` When running this test in ReSharper 6.1 and NUnit 2.5.10, the test is not run twice, as expected, it only runs once. In the test results I see listed ``` my_test("someurl1", System.String[], 15) ``` This makes me think that the two fixtures are being treated as the same, and that NUnit isn't differentiating between the string arrays in the two tests. As a workaround I have added a dummy parameter in the constructor. If I set this to a different value for each fixture, then all the tests run. Is it not possible to have TestFixtures with arrays containing different values? I've just upgraded from ReSharper 5 so I'm wondering if that is related. I have read about some issues with parameterised tests in 6.x.

Original source