I'm using NCrunch 3.6.0.2 on a C# library project with NUnit 3.6.1, targeting .NET 4.5 on Visual Studio 2015. I'm writing parameterized tests like this:
[Test, TestCaseSource(nameof(SomeIntegers))]
public void MyTest(List<int> someIntegers)
{
...
}
private static IEnumerable<List<int>> SomeIntegers {get; }
= new[]
{
new List<int>(1, 2, 3),
new List<int>(4, 5, 6),
new List<int>(7, 8, 9)
};
In tests like the one above, NCrunch only runs the test once, with the first parameter (in this case new List<int>(1, 2, 3)). Both the NUnit console test runner and ReSharper handle this properly.
To make this work under NCrunch, you need to use .SetName on each of the individual test case data elements (i.e. new List<int>(1, 2, 3).SetName("Test case 1"))
rucamzu wrote:Thanks for the help, I've been probably missing NCrunch warning. The link to the documentation is broken, but I'll try to get SetName working. Thanks!
Can you confirm which link you're seeing as broken? Is this the one in the warning?