@@ -359,8 +359,8 @@ public async Task CollectionQueryAsync()
359359 if ( ! TestDialect . SupportsEmptyInsertsOrHasNonIdentityNativeGenerator )
360360 Assert . Ignore ( "Support of empty inserts is required" ) ;
361361
362- ISession s = OpenSession ( ) ;
363- ITransaction t = s . BeginTransaction ( ) ;
362+ using var s = OpenSession ( ) ;
363+ using var t = s . BeginTransaction ( ) ;
364364
365365 Simple s1 = new Simple ( ) ;
366366 s1 . Name = "s" ;
@@ -383,10 +383,15 @@ public async Task CollectionQueryAsync()
383383 l . Add ( null ) ;
384384 l . Add ( s2 ) ;
385385 c . ManyToMany = l ;
386+ c . ManyToOne = new Simple { Name = "x" , Count = 4 } ;
387+ await ( s . SaveAsync ( c . ManyToOne , c . ManyToOne . Count ) ) ;
386388 await ( s . SaveAsync ( c ) ) ;
387389
388390 Assert . AreEqual ( 1 ,
389391 ( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.OneToMany[2] = s" ) . ListAsync
392+ ( ) ) ) . Count ) ;
393+ Assert . AreEqual ( 1 ,
394+ ( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.OneToMany[2] = s and c.ManyToOne.Name = 'x'" ) . ListAsync
390395 ( ) ) ) . Count ) ;
391396 Assert . AreEqual ( 1 ,
392397 ( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.ManyToMany[2] = s" ) .
@@ -424,13 +429,13 @@ public async Task CollectionQueryAsync()
424429 "select c from c in class ContainerX where c.ManyToMany[ c.OneToMany[0].Count ].Name = 's'" ) . ListAsync ( ) ) ) .
425430 Count ) ;
426431
432+ await ( s . DeleteAsync ( c . ManyToOne ) ) ;
427433 await ( s . DeleteAsync ( c ) ) ;
428434 await ( s . DeleteAsync ( s1 ) ) ;
429435 await ( s . DeleteAsync ( s2 ) ) ;
430436 await ( s . DeleteAsync ( s3 ) ) ;
431437
432438 await ( t . CommitAsync ( ) ) ;
433- s . Close ( ) ;
434439 }
435440
436441 [ Test ]
0 commit comments