visualstudio.xunit icon indicating copy to clipboard operation
visualstudio.xunit copied to clipboard

Update from 2.4.1 to 2.4.2 breaks theory test with null/double parameters

Open ronaldhoek opened this issue 2 years ago • 0 comments

I upgraded the xUnit packages from version '2.4.1' tot '2.4.1'. This resulted in several failed tests using a Theory in combination with double? parameters, which are specified as int.

        [Theory]
        // Null waarden ongeldig
        [InlineData(true, 5, null, 7, null)]
        [InlineData(true, 5, 10, 7, 75)]
        [InlineData(true, null, 10, 7, null)]
        // Null waarden geldig
        [InlineData(false, 5, null, 7, 5)]
        [InlineData(false, 5, 10, 7, 75)]
        [InlineData(false, null, 10, 7, 70)]
        public static void AddProduct_ShouldUpdateSommatieAsExpected(bool nullWaardenOngeldig, double? sommatie, double? waarde1, double? waarde2, double? sommatieTest)

        {
            // Code is NOT executed
        }

After changing the int values to double (by adding .0), the problem does not occur.

        [Theory]
        // Null waarden ongeldig
        [InlineData(true, 5.0, null, 7.0, null)]
        [InlineData(true, 5.0, 10.0, 7.0, 75.0)]
        [InlineData(true, null, 10.0, 7.0, null)]
        // Null waarden geldig
        [InlineData(false, 5.0, null, 7.0, 5.0)]
        [InlineData(false, 5.0, 10.0, 7.0, 75.0)]
        [InlineData(false, null, 10.0, 7.0, 70.0)]
        public static void AddProduct_ShouldUpdateSommatieAsExpected(bool nullWaardenOngeldig, double? sommatie, double? waarde1, double? waarde2, double? sommatieTest)

        {
            // Code IS executed
        }

ronaldhoek avatar Oct 10 '22 11:10 ronaldhoek