@@ -143,6 +143,18 @@ public async Task NullInequalityWithNotNullAsync()
143143
144144 q = session . Query < AnotherEntityRequired > ( ) . Where ( o => o . Address . Street != null && o . Address . Street != o . NullableOutput ) ;
145145 await ( ExpectAsync ( q , Does . Contain ( "Output is null" ) . IgnoreCase , InputSet , BothDifferent ) ) ;
146+
147+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => o . CustomerId != null ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
148+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => null != o . CustomerId ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
149+
150+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => o . CustomerId != "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
151+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => "test" != o . CustomerId ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
152+
153+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . CustomerId != "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
154+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" != o . Order . Customer . CustomerId ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
155+
156+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . CompanyName != "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
157+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" != o . Order . Customer . CompanyName ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
146158 }
147159
148160 [ Test ]
@@ -173,10 +185,10 @@ public async Task NullInequalityWithNotNullSubSelectAsync()
173185 public async Task NullEqualityWithNotNullAsync ( )
174186 {
175187 var q = session . Query < AnotherEntityRequired > ( ) . Where ( o => o . Input == null ) ;
176- await ( ExpectAsync ( q , Does . Not . Contain ( "or is null" ) . IgnoreCase , OutputSet , BothNull ) ) ;
188+ await ( ExpectAsync ( q , Does . Contain ( "is null" ) . IgnoreCase , OutputSet , BothNull ) ) ;
177189
178190 q = session . Query < AnotherEntityRequired > ( ) . Where ( o => null == o . Input ) ;
179- await ( ExpectAsync ( q , Does . Not . Contain ( "or is null" ) . IgnoreCase , OutputSet , BothNull ) ) ;
191+ await ( ExpectAsync ( q , Does . Contain ( "is null" ) . IgnoreCase , OutputSet , BothNull ) ) ;
180192
181193 q = session . Query < AnotherEntityRequired > ( ) . Where ( o => o . InputNullability == AnotherEntityNullability . True ) ;
182194 await ( ExpectAsync ( q , Does . Not . Contain ( "end is null" ) . IgnoreCase , BothNull , OutputSet ) ) ;
@@ -291,6 +303,15 @@ public async Task NullEqualityWithNotNullAsync()
291303
292304 q = session . Query < AnotherEntityRequired > ( ) . Where ( o => o . Address . Street != null && o . Address . Street == o . NullableOutput ) ;
293305 await ( ExpectAsync ( q , Does . Not . Contain ( "Output is null" ) . IgnoreCase , BothSame ) ) ;
306+
307+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => o . CustomerId == null ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
308+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => null == o . CustomerId ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
309+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => o . CustomerId == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
310+ await ( ExpectAsync ( session . Query < Customer > ( ) . Where ( o => "test" == o . CustomerId ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
311+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . CustomerId == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
312+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" == o . Order . Customer . CustomerId ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
313+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . CompanyName == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
314+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" == o . Order . Customer . CompanyName ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
294315 }
295316
296317 [ Test ]
@@ -377,6 +398,24 @@ public async Task NullEqualityAsync()
377398 // Columns against columns
378399 q = from x in session . Query < AnotherEntity > ( ) where x . Input == x . Output select x ;
379400 await ( ExpectAsync ( q , BothSame , BothNull ) ) ;
401+
402+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . ContactName == null ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
403+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => null == o . Order . Customer . ContactName ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
404+
405+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . ContactName == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
406+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" == o . Order . Customer . ContactName ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
407+
408+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => null == o . Component . Property1 ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
409+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . Property1 == null ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
410+
411+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => "test" == o . Component . Property1 ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
412+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . Property1 == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
413+
414+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => null == o . Component . OtherComponent . OtherProperty1 ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
415+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . OtherComponent . OtherProperty1 == null ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
416+
417+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => "test" == o . Component . OtherComponent . OtherProperty1 ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
418+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . OtherComponent . OtherProperty1 == "test" ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
380419 }
381420
382421 [ Test ]
@@ -435,6 +474,24 @@ public async Task NullInequalityAsync()
435474 // Columns against columns
436475 q = from x in session . Query < AnotherEntity > ( ) where x . Input != x . Output select x ;
437476 await ( ExpectAsync ( q , BothDifferent , InputSet , OutputSet ) ) ;
477+
478+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . ContactName != null ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
479+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => null != o . Order . Customer . ContactName ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
480+
481+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => o . Order . Customer . ContactName != "test" ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
482+ await ( ExpectAsync ( session . Query < OrderLine > ( ) . Where ( o => "test" != o . Order . Customer . ContactName ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
483+
484+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => null != o . Component . Property1 ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
485+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . Property1 != null ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
486+
487+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => "test" != o . Component . Property1 ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
488+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . Property1 != "test" ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
489+
490+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => null != o . Component . OtherComponent . OtherProperty1 ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
491+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . OtherComponent . OtherProperty1 != null ) , Does . Not . Contain ( "is null" ) . IgnoreCase ) ) ;
492+
493+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => "test" != o . Component . OtherComponent . OtherProperty1 ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
494+ await ( ExpectAsync ( session . Query < User > ( ) . Where ( o => o . Component . OtherComponent . OtherProperty1 != "test" ) , Does . Contain ( "is null" ) . IgnoreCase ) ) ;
438495 }
439496
440497 [ Test ]
@@ -633,6 +690,15 @@ private async Task ExpectAsync(IQueryable<AnotherEntityRequired> q, IResolveCons
633690 return ( await ( q . ToListAsync ( cancellationToken ) ) ) . OrderBy ( Key ) . ToList ( ) ;
634691 }
635692
693+ private static async Task ExpectAsync < T > ( IQueryable < T > query , IResolveConstraint sqlConstraint , CancellationToken cancellationToken = default ( CancellationToken ) )
694+ {
695+ using ( var sqlLog = new SqlLogSpy ( ) )
696+ {
697+ var list = await ( query . ToListAsync ( cancellationToken ) ) ;
698+ Assert . That ( sqlLog . GetWholeLog ( ) , sqlConstraint ) ;
699+ }
700+ }
701+
636702 private static string Key ( AnotherEntityRequired e )
637703 {
638704 return "Input=" + ( e . Input ?? "NULL" ) + ", Output=" + ( e . Output ?? "NULL" ) ;
0 commit comments