@@ -621,6 +621,7 @@ public void NullableTests() {
621621 } . AsQueryable ( ) ;
622622 var parameters = new Dictionary < string , object ? > { { "searchText" , searchText } } ;
623623
624+ // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
624625 var r1 = data . Where ( i => i . Name != null && i . Name . Contains ( searchText ) ) . ToList ( ) ;
625626 var d1 = data . Where ( "i => i.Name != null && i.Name.Contains(searchText)" , parameters ) . ToList ( ) ;
626627 Assert . Equal ( r1 , d1 ) ;
@@ -629,7 +630,9 @@ public void NullableTests() {
629630 var d2 = data . OrderByDescending ( "i => i.Name" ) . ToList ( ) ;
630631 Assert . Equal ( r2 , d2 ) ;
631632
633+ #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
632634 var r3 = data . Where ( i => i . Age != null && i . Age . ToString ( ) . Contains ( searchText ) ) . ToList ( ) ;
635+ #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
633636 var func = Evaluator . ToFunc < bool > (
634637 "i.Age != null && i.Age.ToString().Contains(searchText)" ,
635638 new Dictionary < string , object ? > { { "searchText" , searchText } , { "i" , data . First ( ) } }
@@ -642,7 +645,9 @@ public void NullableTests() {
642645 var d4 = data . Where ( "i => i.Number != null && i.Number.ToString().Contains(searchText)" , parameters ) . ToList ( ) ;
643646 Assert . Equal ( r4 , d4 ) ;
644647
648+ #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
645649 var r5 = data . Where ( i => i . Address != null ! && i . Address . Zip != null && i . Address . Zip . ToString ( ) . Contains ( searchText ) ) . ToList ( ) ;
650+ #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
646651 var d5 = data . Where ( "i => i.Address != null && i.Address.Zip != null && i.Address.Zip.ToString().Contains(searchText)" , parameters ) . ToList ( ) ;
647652 Assert . Equal ( r5 , d5 ) ;
648653
0 commit comments