Build/Test Issues

MSTest v4 - DataRow - Collection Expressions

Started by UppSol on 367 views

Hi, I reported an issue via VS 2026.

It seems that NCrunch does not support DataRow Tests with Collection Expressions, however the VS 2026 test runner and the R# test runner support it, so I think NCrunch should support this as well.

We are using MsTest v4 and C# (.Net 10), the latest version of NCrunch is installed, we get this error: "Test paramter count missmatch" and in the output window I see this error:
"PID:59052 08:26:21.4716 ?-31] The type or namespace name 'I<>' could not be found (are you missing a using directive or an assembly reference?)
[PID:39204 08:26:21.5496 LocalBuildTask-50] ERROR (Build): Upper.ProductLabellingOrderManager.ArticleConnector.Test: C:\Temp\NCrunch\39204\35\Upper.ProductLabellingOrderManager.ArticleConnector.Test\ProfitcenterConverterBehaviour.cs (32): The type or namespace name 'I<>' could not be found (are you missing a using directive or an assembly reference?)"

Here is a very simple sample:

[TestMethod]
[DataRow(["A", "B", "C"])]
[DataRow(["X", "Y", "Z", "K"])]
[DataRow(["U", "V", "W"])]
[DataRow(["S", "X", "K", "W", "V"])]
public void Convert_Should_Only_Return_ProfitcenterIds_That_Are_Available(IReadOnlyCollection<string> profitcenterIds)
{
//arrange
IReadOnlyCollection<Profitcenter> expectedProfitcenters = GetExpectedProfitcenters(profitcenterIds);

//act
IReadOnlyCollection<Profitcenter> result = _converter.Convert(profitcenterIds, _availableProfitcenters);

//assert
result.Should().BeEquivalentTo(expectedProfitcenters);
}

Please let me know if you need more info.

Br

Edited

Hi, thanks for sharing this. I also saw it come in through the bug reporter :)

NCrunch needs some special handling to be able to work with these collection expressions. The latest version doesn't implement them yet. I've noted them down to see if I can plug them into the next release. Thanks again for making me aware of it.

Post a reply

Log in to reply.