Build/Test Issues

Failing tests with XUnit v4 and DateTime parameters

Started by DCasado on 2 views

Hi,

we updated to the latest version of XUnit (4.0.0) and NCrunch (5.23.0.1).

Some of our tests are now failing and they all have a DateTime parameter:


using AwesomeAssertions;

namespace NCrunchIssue
{
    public class UnitTest1
    {
        public static TheoryData<DateTime> TestDates => new() { { new DateTime(2025, 12, 31) } };

        [Theory]
        [MemberData(nameof(TestDates))]
        public void DateTest(DateTime expected)
        {
            expected.ToString("O").Should().Be("2025-12-31T00:00:00.0000000");
        }
    }
}



I can run the test successfully with VS Test explorer.
By downgrading XUnit to version 3.2.2 the test is successful in both (VS Test Explorer and NCrunch Tests).

You can find a working repro here: https://github.com/IT-CASADO/ncrunch-issue-02

Edited

Post a reply

Log in to reply.