After today's upgrade to xUnit 2.9.1 we've found an issue with tests that are parameterized by arrays of objects e.g.
[Theory]
[MemberData(nameof(ExampleParameters))]
public void ExampleParameterizedTestMethod(string[] values)
{
Assert.All(values, s => Assert.True(s.Length < 10));
}
public static TheoryData<string[]> ExampleParameters =>
new TheoryData<string[]>
{
{ new string[] { "0", "2", "4" } },
{ new string[] { "0", "8", "6" } }
};
This code consistently fails with "Test method expected 1 parameter value but n parameter values were provided" as if it interpreting the array as a set of parameters instead of a single parameter.
Release notes state "any code that was previously depending on it returning IEnumerable<object[]> may need to be rewritten (i.e., casting the data to IEnumerable<object[]> explicitly before enumerating)." but I honestly don't see where I could be explicitly casting/specifying the types any more?
When T is a primitive (e.g. int) everything seems to work okay, but not so much with objects.
It doesn't seem to fail if we use List instead of T[] so we have a workaround for now, but I thought you guys should be aware
After today's upgrade to xUnit 2.9.1 we've found an issue with tests that are parameterized by arrays of objects e.g.
This code consistently fails with "Test method expected 1 parameter value but n parameter values were provided" as if it interpreting the array as a set of parameters instead of a single parameter.
Release notes state "any code that was previously depending on it returning IEnumerable<object[]> may need to be rewritten (i.e., casting the data to IEnumerable<object[]> explicitly before enumerating)." but I honestly don't see where I could be explicitly casting/specifying the types any more?
When T is a primitive (e.g. int) everything seems to work okay, but not so much with objects.
It doesn't seem to fail if we use List instead of T[] so we have a workaround for now, but I thought you guys should be aware