NUnit TestCaseSource returns the same data for different yields

647 views Asked by At

I have the issue with NUnit framework and TestCaseSourse. I have some test data:

public TestData[] data = new TestDataBuilder()
                .Add("inputFile", "132JoinTest.xml")
                .AddRange("delimiter", ";", "")
                .AddAllSubsets("sectionNames", new string[] { "Headline", "Byline", "Summary" }).GetTestData();

Also I have the data for TestCaseSource:

public IEnumerable<TestCaseData> ReduceTagsNumber
{
    get
    {
        yield return new TestCaseData(data[0]);
        yield return new TestCaseData(data[1]);
    }
}
[TestCaseSource("ReduceTagsNumber")]
public void Execute_ForInputThatCouldBeJoined_ReduceTagsNumber(TestData data)
{
    //some code here
}

I double check, that data[0] and data[1] contains the different data. But when I run NUnit tests both of them are runned with data[0]. I try to implement this in the different ways, but always the same result. Note: If i use the TestData structure instead the TestData class the Nunit doesn't see the second testCase at all.

0

There are 0 answers