Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Array as datarow attribute parameter
konstantin
#1 Posted : Thursday, July 12, 2018 1:16:06 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/12/2018(UTC)
Posts: 2
Location: Russia

Hello,
There is problem in datarow attribute for unit test method. NCrunch can not substitute array parameter into test method.

For example:

[TestMethod]
[DataRow(new string[] { "0" }, false)]
[DataRow(new string[] { "0", "0", "0" }, false)]
[DataRow(new string[] { "0.0001" }, true)]
[DataRow(new string[] { "0", "5" }, true)]
[DataRow(new string[] { "0", "0.0001" }, true)]
[DataRow(new string[] { "0.0001", "0.0001" }, true)]
public void Test1_ExpectSuccess(string[] rateValues, bool expectedResult)
{
...
}

throw an exemption:
Type mismatch on test parameter 1 (System.String[] != System.Object[])

Best regards,
Konstantin
Remco
#2 Posted : Thursday, July 12, 2018 9:25:02 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,373

Thanks: 705 times
Was thanked: 878 time(s) in 835 post(s)
Hi Konstantin,

Do you experience this problem if you set your 'Framework utilisation type for MSTest' to 'DynamicAnalysis'?

DynamicAnalysis provides better support for edge cases like this one.
konstantin
#3 Posted : Friday, July 13, 2018 9:43:33 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/12/2018(UTC)
Posts: 2
Location: Russia

Thanks a lot, Remco. It works.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.022 seconds.