@@ -149,6 +149,7 @@ public void Eq()
149
149
var subject = CreateSubject < BsonDocument > ( ) ;
150
150
151
151
Assert ( subject . Eq ( "x" , 10 ) , "{x: 10}" ) ;
152
+ Assert ( subject . AnyEq ( "x" , 10 ) , "{x: 10}" ) ;
152
153
}
153
154
154
155
[ Test ]
@@ -158,6 +159,11 @@ public void Eq_Typed()
158
159
Assert ( subject . Eq ( x => x . FirstName , "Jack" ) , "{fn: 'Jack'}" ) ;
159
160
Assert ( subject . Eq ( "FirstName" , "Jim" ) , "{fn: 'Jim'}" ) ;
160
161
Assert ( subject . Eq ( "firstName" , "Jim" ) , "{firstName: 'Jim'}" ) ;
162
+ Assert ( subject . Eq ( x => x . FavoriteColors , new [ ] { "yellow" , "green" } ) , "{colors: ['yellow', 'green']}" ) ;
163
+ Assert ( subject . Eq ( "FavoriteColors" , new [ ] { "yellow" , "green" } ) , "{colors: ['yellow', 'green']}" ) ;
164
+
165
+ Assert ( subject . AnyEq ( x => x . FavoriteColors , "yellow" ) , "{colors: 'yellow'}" ) ;
166
+ Assert ( subject . AnyEq ( "FavoriteColors" , "yellow" ) , "{colors: 'yellow'}" ) ;
161
167
}
162
168
163
169
[ Test ]
@@ -326,6 +332,7 @@ public void GreaterThan()
326
332
var subject = CreateSubject < BsonDocument > ( ) ;
327
333
328
334
Assert ( subject . Gt ( "x" , 10 ) , "{x: {$gt: 10}}" ) ;
335
+ Assert ( subject . AnyGt ( "x" , 10 ) , "{x: {$gt: 10}}" ) ;
329
336
}
330
337
331
338
[ Test ]
@@ -334,6 +341,9 @@ public void GreaterThan_Typed()
334
341
var subject = CreateSubject < Person > ( ) ;
335
342
Assert ( subject . Gt ( x => x . Age , 10 ) , "{age: {$gt: 10}}" ) ;
336
343
Assert ( subject . Gt ( "Age" , 10 ) , "{age: {$gt: 10}}" ) ;
344
+
345
+ Assert ( subject . AnyGt ( x => x . FavoriteColors , "green" ) , "{colors: {$gt: 'green'}}" ) ;
346
+ Assert ( subject . AnyGt ( "FavoriteColors" , "green" ) , "{colors: {$gt: 'green'}}" ) ;
337
347
}
338
348
339
349
[ Test ]
@@ -342,6 +352,7 @@ public void GreaterThanOrEqual()
342
352
var subject = CreateSubject < BsonDocument > ( ) ;
343
353
344
354
Assert ( subject . Gte ( "x" , 10 ) , "{x: {$gte: 10}}" ) ;
355
+ Assert ( subject . AnyGte ( "x" , 10 ) , "{x: {$gte: 10}}" ) ;
345
356
}
346
357
347
358
[ Test ]
@@ -350,6 +361,9 @@ public void GreaterThanOrEqual_Typed()
350
361
var subject = CreateSubject < Person > ( ) ;
351
362
Assert ( subject . Gte ( x => x . Age , 10 ) , "{age: {$gte: 10}}" ) ;
352
363
Assert ( subject . Gte ( "Age" , 10 ) , "{age: {$gte: 10}}" ) ;
364
+
365
+ Assert ( subject . AnyGte ( x => x . FavoriteColors , "green" ) , "{colors: {$gte: 'green'}}" ) ;
366
+ Assert ( subject . AnyGte ( "FavoriteColors" , "green" ) , "{colors: {$gte: 'green'}}" ) ;
353
367
}
354
368
355
369
[ Test ]
@@ -358,14 +372,18 @@ public void In()
358
372
var subject = CreateSubject < BsonDocument > ( ) ;
359
373
360
374
Assert ( subject . In ( "x" , new [ ] { 10 , 20 } ) , "{x: {$in: [10,20]}}" ) ;
375
+ Assert ( subject . AnyIn ( "x" , new [ ] { 10 , 20 } ) , "{x: {$in: [10,20]}}" ) ;
361
376
}
362
377
363
378
[ Test ]
364
379
public void In_Typed ( )
365
380
{
366
381
var subject = CreateSubject < Person > ( ) ;
367
- Assert ( subject . In ( x => x . FavoriteColors , new [ ] { "blue" , "green" } ) , "{colors: {$in: ['blue','green']}}" ) ;
368
- Assert ( subject . In ( "FavoriteColors" , new [ ] { "blue" , "green" } ) , "{colors: {$in: ['blue','green']}}" ) ;
382
+ Assert ( subject . In ( x => x . Age , new [ ] { 10 , 20 } ) , "{age: {$in: [10, 20]}}" ) ;
383
+ Assert ( subject . In ( "Age" , new [ ] { 10 , 20 } ) , "{age: {$in: [10, 20]}}" ) ;
384
+
385
+ Assert ( subject . AnyIn ( x => x . FavoriteColors , new [ ] { "blue" , "green" } ) , "{colors: {$in: ['blue','green']}}" ) ;
386
+ Assert ( subject . AnyIn ( "FavoriteColors" , new [ ] { "blue" , "green" } ) , "{colors: {$in: ['blue','green']}}" ) ;
369
387
}
370
388
371
389
[ Test ]
@@ -374,6 +392,7 @@ public void Lt()
374
392
var subject = CreateSubject < BsonDocument > ( ) ;
375
393
376
394
Assert ( subject . Lt ( "x" , 10 ) , "{x: {$lt: 10}}" ) ;
395
+ Assert ( subject . AnyLt ( "x" , 10 ) , "{x: {$lt: 10}}" ) ;
377
396
}
378
397
379
398
[ Test ]
@@ -382,6 +401,9 @@ public void Lt_Typed()
382
401
var subject = CreateSubject < Person > ( ) ;
383
402
Assert ( subject . Lt ( x => x . Age , 10 ) , "{age: {$lt: 10}}" ) ;
384
403
Assert ( subject . Lt ( "Age" , 10 ) , "{age: {$lt: 10}}" ) ;
404
+
405
+ Assert ( subject . AnyLt ( x => x . FavoriteColors , "green" ) , "{colors: {$lt: 'green'}}" ) ;
406
+ Assert ( subject . AnyLt ( "FavoriteColors" , "green" ) , "{colors: {$lt: 'green'}}" ) ;
385
407
}
386
408
387
409
[ Test ]
@@ -390,6 +412,7 @@ public void Lte()
390
412
var subject = CreateSubject < BsonDocument > ( ) ;
391
413
392
414
Assert ( subject . Lte ( "x" , 10 ) , "{x: {$lte: 10}}" ) ;
415
+ Assert ( subject . AnyLte ( "x" , 10 ) , "{x: {$lte: 10}}" ) ;
393
416
}
394
417
395
418
[ Test ]
@@ -398,6 +421,9 @@ public void Lte_Typed()
398
421
var subject = CreateSubject < Person > ( ) ;
399
422
Assert ( subject . Lte ( x => x . Age , 10 ) , "{age: {$lte: 10}}" ) ;
400
423
Assert ( subject . Lte ( "Age" , 10 ) , "{age: {$lte: 10}}" ) ;
424
+
425
+ Assert ( subject . AnyLte ( x => x . FavoriteColors , "green" ) , "{colors: {$lte: 'green'}}" ) ;
426
+ Assert ( subject . AnyLte ( "FavoriteColors" , "green" ) , "{colors: {$lte: 'green'}}" ) ;
401
427
}
402
428
403
429
[ Test ]
@@ -414,15 +440,18 @@ public void Mod_Typed()
414
440
var subject = CreateSubject < Person > ( ) ;
415
441
Assert ( subject . Mod ( x => x . Age , 10 , 4 ) , "{age: {$mod: [NumberLong(10), NumberLong(4)]}}" ) ;
416
442
Assert ( subject . Mod ( "Age" , 10 , 4 ) , "{age: {$mod: [NumberLong(10), NumberLong(4)]}}" ) ;
417
- }
418
443
444
+ Assert ( subject . Mod ( x => x . FavoriteColors , 10 , 4 ) , "{colors: {$mod: [NumberLong(10), NumberLong(4)]}}" ) ;
445
+ Assert ( subject . Mod ( "FavoriteColors" , 10 , 4 ) , "{colors: {$mod: [NumberLong(10), NumberLong(4)]}}" ) ;
446
+ }
419
447
420
448
[ Test ]
421
449
public void Ne ( )
422
450
{
423
451
var subject = CreateSubject < BsonDocument > ( ) ;
424
452
425
453
Assert ( subject . Ne ( "x" , 10 ) , "{x: {$ne: 10}}" ) ;
454
+ Assert ( subject . AnyNe ( "x" , 10 ) , "{x: {$ne: 10}}" ) ;
426
455
}
427
456
428
457
[ Test ]
@@ -431,6 +460,9 @@ public void Ne_Typed()
431
460
var subject = CreateSubject < Person > ( ) ;
432
461
Assert ( subject . Ne ( x => x . Age , 10 ) , "{age: {$ne: 10}}" ) ;
433
462
Assert ( subject . Ne ( "Age" , 10 ) , "{age: {$ne: 10}}" ) ;
463
+
464
+ Assert ( subject . AnyNe ( x => x . FavoriteColors , "green" ) , "{colors: {$ne: 'green'}}" ) ;
465
+ Assert ( subject . AnyNe ( "FavoriteColors" , "green" ) , "{colors: {$ne: 'green'}}" ) ;
434
466
}
435
467
436
468
[ Test ]
@@ -527,14 +559,18 @@ public void Nin()
527
559
var subject = CreateSubject < BsonDocument > ( ) ;
528
560
529
561
Assert ( subject . Nin ( "x" , new [ ] { 10 , 20 } ) , "{x: {$nin: [10,20]}}" ) ;
562
+ Assert ( subject . AnyNin ( "x" , new [ ] { 10 , 20 } ) , "{x: {$nin: [10,20]}}" ) ;
530
563
}
531
564
532
565
[ Test ]
533
566
public void Nin_Typed ( )
534
567
{
535
568
var subject = CreateSubject < Person > ( ) ;
536
- Assert ( subject . Nin ( x => x . FavoriteColors , new [ ] { "blue" , "green" } ) , "{colors: {$nin: ['blue','green']}}" ) ;
537
- Assert ( subject . Nin ( "FavoriteColors" , new [ ] { "blue" , "green" } ) , "{colors: {$nin: ['blue','green']}}" ) ;
569
+ Assert ( subject . Nin ( x => x . Age , new [ ] { 10 , 20 } ) , "{age: {$nin: [10, 20]}}" ) ;
570
+ Assert ( subject . Nin ( "Age" , new [ ] { 10 , 20 } ) , "{age: {$nin: [10, 20]}}" ) ;
571
+
572
+ Assert ( subject . AnyNin ( x => x . FavoriteColors , new [ ] { "blue" , "green" } ) , "{colors: {$nin: ['blue','green']}}" ) ;
573
+ Assert ( subject . AnyNin ( "FavoriteColors" , new [ ] { "blue" , "green" } ) , "{colors: {$nin: ['blue','green']}}" ) ;
538
574
}
539
575
540
576
[ Test ]
@@ -599,7 +635,7 @@ public void Not_with_not_equal()
599
635
public void Not_with_not_in ( )
600
636
{
601
637
var subject = CreateSubject < BsonDocument > ( ) ;
602
- var filter = subject . Not ( subject . Nin ( "a" , new [ ] { 10 , 20 } ) ) ;
638
+ var filter = subject . Not ( subject . AnyNin ( "a" , new [ ] { 10 , 20 } ) ) ;
603
639
604
640
Assert ( filter , "{a: {$in: [10, 20]}}" ) ;
605
641
}
@@ -676,6 +712,9 @@ public void Regex_Typed()
676
712
var subject = CreateSubject < Person > ( ) ;
677
713
Assert ( subject . Regex ( x => x . FirstName , "/abc/" ) , "{fn: /abc/}" ) ;
678
714
Assert ( subject . Regex ( "FirstName" , "/abc/" ) , "{fn: /abc/}" ) ;
715
+
716
+ Assert ( subject . Regex ( x => x . FavoriteColors , "/abc/" ) , "{colors: /abc/}" ) ;
717
+ Assert ( subject . Regex ( "FavoriteColors" , "/abc/" ) , "{colors: /abc/}" ) ;
679
718
}
680
719
681
720
[ Test ]
0 commit comments