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

Notification

Icon
Error

Bug: DataTestMethod with DynamicData shows wrong result
fsdMatthias
#1 Posted : Monday, November 12, 2018 12:36:12 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/12/2018(UTC)
Posts: 4

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
The following Test shows the status "Passed" even if it should fail.

Code:

        public static IEnumerable<object[]> testInput => new[]
        {
                new object[] { new[] { 1 } },
                new object[] { new[] { 1, 2 } },
        };

        [DataTestMethod]
        [DynamicData(nameof(testInput))]
        public void TestDynamicData(int[] testData)
        {
            CollectionAssert.AreEqual(testData, new[] { 1, 2 });
        }


The problem seams to exist if the last check is valid.
The following code produces the expected result ("Failed").

Code:

        public static IEnumerable<object[]> testInput => new[]
        {
                new object[] { new[] { 1, 2 } },
                new object[] { new[] { 1 } },
        };

        [DataTestMethod]
        [DynamicData(nameof(testInput))]
        public void TestDynamicData(int[] testData)
        {
            CollectionAssert.AreEqual(testData, new[] { 1, 2 });
        }


NCrunch Version 3.22.0.1
Remco
#2 Posted : Tuesday, November 13, 2018 1:15:52 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
fsdMatthias
#3 Posted : Tuesday, November 13, 2018 8:03:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/12/2018(UTC)
Posts: 4

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I checked with the new version and it works now as expected.

Thanks
1 user thanked fsdMatthias for this useful post.
Remco on 11/13/2018(UTC)
Users browsing this topic
Guest
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.028 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download