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

Notification

Icon
Error

Error not picked up
Teejwex
#1 Posted : Friday, May 22, 2026 5:30:52 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/22/2026(UTC)
Posts: 1

Hi,

I am passing some complex objects to an xunit test. I see in other posts that NCrunch will collapse these test and show a single result.

The problem that i have though is that single result was showing a pass. When i used VS2022 test runner it correctly showed a fail for one of the tests.

In my case it will return the result of the last test and hide any earlier failures - not ideal. The RDI shows that the method evaluation and the expected result were different values and shows the full set of calls made to the test method.

Is there a way to resolve this? I tried the suggestion of using IXunitSerializable from one of the other posts but the tests took way too long to run and all showed a fail then.


Code:
    [Theory]
    [ClassData(typeof(GetChosenSummerSelection))]
    internal void MixedLeagueClass_ShouldBeBasedOnSummerLeagueSelectionAndNomination(
        TestCase data)
    {
        var result = CallEvaluate(
            data.MixedLeagueRank,
            data.SummerSelectedDivisions,
            data.SummerNominatedRank);
        result.Should().Be(data.Expected);
    }

...

    internal class GetChosenSummerSelection : TheoryData<TestCase>
    {
        public GetChosenSummerSelection()
        {
            Add(new TestCase(10, "", DR.Class1, [CreateSelected(DR.Class2, 1)], null, true));
            Add(new TestCase(20, "", DR.Class1, [CreateSelected(DR.Class3, 1)], null, true));
        }
    }


This shows the results

[img]null[/img]test runner


Thanks
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.020 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download