@@ -167,7 +167,7 @@ public void Any_with_a_predicate_on_documents_itself_and_ClassEquals()
167167 Assert (
168168 x => x . G . Any ( g => g == c1 ) ,
169169 1 ,
170- "{ \" G\" : { \" $elemMatch\" : { \" Ids\" : null, \" D\" : \" Dolphin\" , \" E\" : { \" F\" : 55, \" H\" : 66, \" I\" : [\" insecure\" ] }, \" S\" : null, \" X\" : null } } }" ) ;
170+ "{ \" G\" : { \" $elemMatch\" : { \" Ids\" : null, \" D\" : \" Dolphin\" , \" E\" : { \" F\" : 55, \" H\" : 66, \" I\" : [\" insecure\" ], \" C \" : null }, \" S\" : null, \" X\" : null, \" Y \" : null, \" Z \" : null } } }" ) ;
171171 }
172172
173173 [ Fact ]
@@ -239,6 +239,79 @@ public void Any_with_a_multi_conditions_predicate_on_documents()
239239 "{ \" G\" : { \" $elemMatch\" : { \" $or\" : [{ \" D\" : \" Don't\" }, { \" E.F\" : { \" $ne\" : 32 } }] } } }" ) ;
240240 }
241241
242+ [ Fact ]
243+ public void Any_with_advanced_nested_Anys ( )
244+ {
245+ Assert (
246+ i => i . G . Any ( g => g . Y . S . Any ( s => s . Z . Any ( z => z . C . E . C . X . Any ( ) ) ) ) ,
247+ 1 ,
248+ "{ \" G.Y.S.Z\" : { $elemMatch : { \" C.E.C.X\" : { $ne : null, $not : { $size : 0 } } } } }" ) ;
249+
250+ Assert (
251+ i => i . G . Any ( g => g . Y . S . Any ( s => s . Z . Any ( z => z . C . X . Any ( x => x . F == 4 ) ) ) ) ,
252+ 1 ,
253+ "{ \" G.Y.S.Z.C.X\" : { $elemMatch : { \" F\" : 4 } } }" ) ;
254+
255+ Assert (
256+ i => i . G . Any ( g => g . D == "Don't" && g . S . Any ( s => s . Z . Any ( x => x . H == 0 ) ) ) ,
257+ 1 ,
258+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" S.Z\" : { $elemMatch : { \" H\" : 0 } } } } }" ) ;
259+
260+ Assert (
261+ i => i . G . Any ( g => g . D == "Don't" && g . Y . S . Any ( s => s . Z . Any ( x => x . H == 0 ) ) ) ,
262+ 1 ,
263+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" Y.S.Z\" : { $elemMatch : { \" H\" : 0 } } } } }" ) ;
264+
265+ Assert (
266+ i => i . G . Any ( g => g . D == "Don't" && g . S . Any ( s => s . E == null && s . Z . Any ( x => x . H == 0 ) ) ) ,
267+ 1 ,
268+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" S\" : { $elemMatch : { \" E\" : null, \" Z\" : { $elemMatch : { \" H\" : 0 } } } } } } }" ) ;
269+
270+ Assert (
271+ i => i . G . Any ( g => g . D == "Don't" && g . Y . S . Any ( s => s . E == null && s . Z . Any ( x => x . H == 0 ) ) ) ,
272+ 1 ,
273+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" Y.S\" : { $elemMatch : { \" E\" : null, \" Z\" : { $elemMatch : { \" H\" : 0 } } } } } } }" ) ;
274+
275+ Assert (
276+ i => i . G . Any ( g => g . D == "Don't" && g . Y . S . Any ( s => s . E == null && s . Z . Any ( z => z . C . X . Any ( x => x . F == 4 ) ) ) ) ,
277+ 1 ,
278+ "{ G: { $elemMatch : { \" D\" : \" Don't\" , \" Y.S\" : { $elemMatch : { \" E\" : null, \" Z.C.X\" : { $elemMatch : { \" F\" : 4 } } } } } } }" ) ;
279+
280+ Assert (
281+ i => i . G . Any ( g => g . D == "Don't" && g . Y . S . Any ( s => s . E == null && s . Z . Any ( z => z . C . X . Any ( x => x . F == 4 && x . H == 0 ) ) ) ) ,
282+ 1 ,
283+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" Y.S\" : { $elemMatch : { \" E\" : null, \" Z.C.X\" : { $elemMatch : { \" F\" : 4, \" H\" : 0 } } } } } } }" ) ;
284+
285+ Assert (
286+ i => i . G . Any ( g => g . D == "Don't" && g . Y . S . Any ( s => s . E == null && s . Z . Any ( z => z . F == 1 && z . C . X . Any ( x => x . F == 4 && x . H == 0 ) ) ) ) ,
287+ 1 ,
288+ "{ G : { $elemMatch : { \" D\" : \" Don't\" , \" Y.S\" : { $elemMatch : { \" E\" : null, \" Z\" : { $elemMatch : { \" F\" : 1, \" C.X\" : { $elemMatch : { \" F\" : 4, \" H\" : 0 } } } } } } } } }" ) ;
289+
290+ Assert (
291+ i => i . G . Any (
292+ g => g . D == "Don't" &&
293+ g . Y . S . Any ( s => s . Z . Any ( z => z . C . X . Any ( x => x . F == 4 ) ) ) &&
294+ g . S . Any ( s => s . D == "Delilah" && s . Z . Any ( z => z . F == 1 && z . H == 0 ) ) ) ,
295+ 1 ,
296+ @"{ G : { $elemMatch : {
297+ ""D"" : ""Don't"",
298+ ""Y.S.Z.C.X"" : { $elemMatch : { ""F"" : 4 } },
299+ ""S"" : { $elemMatch : { ""D"" : ""Delilah"", ""Z"" : { $elemMatch : { ""F"" : 1, ""H"" : 0 } } } }
300+ } } }" ) ;
301+
302+ Assert (
303+ i => i . G . Any (
304+ g => g . D == "Don't" &&
305+ g . Y . S . Any ( s => s . E == null && s . Z . Any ( z => z . F == 1 && z . C . X . Any ( x => x . F == 4 && x . H == 0 ) ) ) &&
306+ g . S . Any ( s => s . D == "Delilah" && s . Z . Any ( z => z . F == 1 && z . H == 0 ) ) ) ,
307+ 1 ,
308+ @"{ G : { $elemMatch : {
309+ ""D"" : ""Don't"",
310+ ""Y.S"" : { $elemMatch : { ""E"" : null, ""Z"" : { $elemMatch : { ""F"" : 1, ""C.X"" : { $elemMatch : { ""F"" : 4, ""H"" : 0 } } } } } },
311+ ""S"" : { $elemMatch : { ""D"" : ""Delilah"", ""Z"" : { $elemMatch : { ""F"" : 1, ""H"" : 0 } } } }
312+ } } }" ) ;
313+ }
314+
242315 [ Fact ]
243316 public void Any_with_a_nested_Any ( )
244317 {
@@ -635,7 +708,7 @@ public void ClassEquals()
635708 Assert (
636709 x => x . C == new C { D = "Dexter" } ,
637710 0 ,
638- "{ C : { Ids : null, D : 'Dexter', E : null, S : null, X : null } }" ) ;
711+ "{ C : { Ids : null, D : 'Dexter', E : null, S : null, X : null, Y : null, Z : null } }" ) ;
639712 }
640713
641714 [ Fact ]
@@ -644,7 +717,7 @@ public void ClassEqualsMethod()
644717 Assert (
645718 x => x . C . Equals ( new C { D = "Dexter" } ) ,
646719 0 ,
647- "{ C : { Ids : null, D : 'Dexter', E : null, S : null, X : null } }" ) ;
720+ "{ C : { Ids : null, D : 'Dexter', E : null, S : null, X : null, Y : null, Z : null } }" ) ;
648721 }
649722
650723 [ Fact ]
@@ -653,7 +726,7 @@ public void ClassNotEquals()
653726 Assert (
654727 x => x . C != new C { D = "Dexter" } ,
655728 2 ,
656- "{ C : { $ne : { Ids : null, D : 'Dexter', E : null, S : null, X : null } } }" ) ;
729+ "{ C : { $ne : { Ids : null, D : 'Dexter', E : null, S : null, X : null, Y : null, Z : null } } }" ) ;
657730 }
658731
659732 [ Fact ]
0 commit comments