xunit works correctly when the test parameter has a primitive type - string, int, etc. These parameters are displayed in the displayName attribute:
[Theory]
[MemberData(nameof(GetParameters1))]
public void Parametrized1(string param1, int param2)
{
}
public static IEnumerable<object[]> GetParameters1()
{
for (var i = 0; i < 1; i++)
{
yield return new object[]
{
$"Abc {i}",
i
};
}
}
If at least one of the attributes is not of primitive type, all parameters disappear from displayName:
[Theory]
[MemberData(nameof(GetParameters2))]
public void Parametrized2(string param1, int param2, IReadOnlyCollection<Data2> param3)
{
}
public static IEnumerable<object[]> GetParameters2()
{
for (var i = 0; i < 1; i++)
{
yield return new object[]
{
$"Abc {i}",
i,
ImmutableArray.Create(
new Data2("str 1", 33),
new Data2("str 2", 99))
};
}
}
public record Data2(string StrVal, double DoubleVal);
It would be useful to add a resultDisplayName attribute that contains the correct value - with all parameters. For example, this is necessary for correct generation of allure test reports
xunit works correctly when the test parameter has a primitive type - string, int, etc. These parameters are displayed in the displayName attribute:
If at least one of the attributes is not of primitive type, all parameters disappear from displayName:
It would be useful to add a resultDisplayName attribute that contains the correct value - with all parameters. For example, this is necessary for correct generation of allure test reports