@@ -389,6 +389,58 @@ public void Where_Dynamic_CompareObjectToInt_ConvertObjectToSupportComparisonIsF
389389 act . Should ( ) . Throw < InvalidOperationException > ( ) . And . Message . Should ( ) . MatchRegex ( "The binary operator .* is not defined for the types" ) ;
390390 }
391391
392+ [ Fact ]
393+ public void Where_Dynamic_NullPropagation_Test1_On_NullableDoubleToString_When_AllowEqualsAndToStringMethodsOnObject_True ( )
394+ {
395+ // Arrange
396+ var config = new ParsingConfig
397+ {
398+ AllowEqualsAndToStringMethodsOnObject = true
399+ } ;
400+ var queryable = new [ ]
401+ {
402+ new { id = "1" , d = ( double ? ) null } ,
403+ new { id = "2" , d = ( double ? ) 5 } ,
404+ new { id = "3" , d = ( double ? ) 50 } ,
405+ new { id = "4" , d = ( double ? ) 40 }
406+ } . AsQueryable ( ) ;
407+
408+ // Act
409+ var result = queryable
410+ . Where ( config , """np(it.d, 0).ToString().StartsWith("5", StringComparison.OrdinalIgnoreCase)""" )
411+ . Select < double ? > ( "d" )
412+ . ToArray ( ) ;
413+
414+ // Assert
415+ result . Should ( ) . ContainInConsecutiveOrder ( 5 , 50 ) ;
416+ }
417+
418+ [ Fact ]
419+ public void Where_Dynamic_NullPropagation_Test2_On_NullableDoubleToString_When_AllowEqualsAndToStringMethodsOnObject_True ( )
420+ {
421+ // Arrange
422+ var config = new ParsingConfig
423+ {
424+ AllowEqualsAndToStringMethodsOnObject = true
425+ } ;
426+ var queryable = new [ ]
427+ {
428+ new { id = "1" , d = ( double ? ) null } ,
429+ new { id = "2" , d = ( double ? ) 5 } ,
430+ new { id = "3" , d = ( double ? ) 50 } ,
431+ new { id = "4" , d = ( double ? ) 40 }
432+ } . AsQueryable ( ) ;
433+
434+ // Act
435+ var result = queryable
436+ . Where ( config , """np(it.d.ToString(), "").StartsWith("5", StringComparison.OrdinalIgnoreCase)""" )
437+ . Select < double ? > ( "d" )
438+ . ToArray ( ) ;
439+
440+ // Assert
441+ result . Should ( ) . ContainInConsecutiveOrder ( 5 , 50 ) ;
442+ }
443+
392444 [ ExcludeFromCodeCoverage ]
393445 private class PersonWithObject
394446 {
0 commit comments