@@ -150,7 +150,7 @@ public void Setup()
150
150
// documents inserted deliberately out of order to test sorting
151
151
_collection . Drop ( ) ;
152
152
_collection . Insert ( new C { Id = _id2 , X = 2 , Y = 11 , D = new D { Z = 22 } , A = new [ ] { 2 , 3 , 4 } , L = new List < int > { 2 , 3 , 4 } } ) ;
153
- _collection . Insert ( new C { Id = _id1 , X = 1 , Y = 11 , D = new D { Z = 11 } , S = "x is 1 " , SA = new string [ ] { "Tom" , "Dick" , "Harry" } } ) ;
153
+ _collection . Insert ( new C { Id = _id1 , X = 1 , Y = 11 , D = new D { Z = 11 } , S = "abc " , SA = new string [ ] { "Tom" , "Dick" , "Harry" } } ) ;
154
154
_collection . Insert ( new C { Id = _id3 , X = 3 , Y = 33 , D = new D { Z = 33 } , B = true , BA = new bool [ ] { true } , E = E . A , EA = new E [ ] { E . A , E . B } } ) ;
155
155
_collection . Insert ( new C { Id = _id5 , X = 5 , Y = 44 , D = new D { Z = 55 } , DBRef = new MongoDBRef ( "db" , "c" , 1 ) } ) ;
156
156
_collection . Insert ( new C { Id = _id4 , X = 4 , Y = 44 , D = new D { Z = 44 } } ) ;
@@ -518,7 +518,7 @@ public void TestDistinctS()
518
518
select c . S ) . Distinct ( ) ;
519
519
var results = query . ToList ( ) ;
520
520
Assert . AreEqual ( 1 , results . Count ) ;
521
- Assert . IsTrue ( results . Contains ( "x is 1 " ) ) ;
521
+ Assert . IsTrue ( results . Contains ( "abc " ) ) ;
522
522
}
523
523
524
524
[ Test ]
@@ -4213,10 +4213,10 @@ public void TestWhereSASub0StartsWithTNot()
4213
4213
}
4214
4214
4215
4215
[ Test ]
4216
- public void TestWhereSContainsX ( )
4216
+ public void TestWhereSContainsAbc ( )
4217
4217
{
4218
4218
var query = from c in _collection . AsQueryable < C > ( )
4219
- where c . S . Contains ( "x " )
4219
+ where c . S . Contains ( "abc " )
4220
4220
select c ;
4221
4221
4222
4222
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4225,21 +4225,21 @@ where c.S.Contains("x")
4225
4225
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4226
4226
4227
4227
var selectQuery = ( SelectQuery ) translatedQuery ;
4228
- Assert . AreEqual ( "(C c) => c.S.Contains(\" x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4228
+ Assert . AreEqual ( "(C c) => c.S.Contains(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4229
4229
Assert . IsNull ( selectQuery . OrderBy ) ;
4230
4230
Assert . IsNull ( selectQuery . Projection ) ;
4231
4231
Assert . IsNull ( selectQuery . Skip ) ;
4232
4232
Assert . IsNull ( selectQuery . Take ) ;
4233
4233
4234
- Assert . AreEqual ( "{ \" s\" : /x / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4234
+ Assert . AreEqual ( "{ \" s\" : /abc / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4235
4235
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4236
4236
}
4237
4237
4238
4238
[ Test ]
4239
- public void TestWhereSContainsXNot ( )
4239
+ public void TestWhereSContainsAbcNot ( )
4240
4240
{
4241
4241
var query = from c in _collection . AsQueryable < C > ( )
4242
- where ! c . S . Contains ( "x " )
4242
+ where ! c . S . Contains ( "abc " )
4243
4243
select c ;
4244
4244
4245
4245
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4248,21 +4248,21 @@ public void TestWhereSContainsXNot()
4248
4248
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4249
4249
4250
4250
var selectQuery = ( SelectQuery ) translatedQuery ;
4251
- Assert . AreEqual ( "(C c) => !c.S.Contains(\" x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4251
+ Assert . AreEqual ( "(C c) => !c.S.Contains(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4252
4252
Assert . IsNull ( selectQuery . OrderBy ) ;
4253
4253
Assert . IsNull ( selectQuery . Projection ) ;
4254
4254
Assert . IsNull ( selectQuery . Skip ) ;
4255
4255
Assert . IsNull ( selectQuery . Take ) ;
4256
4256
4257
- Assert . AreEqual ( "{ \" s\" : { \" $not\" : /x / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4257
+ Assert . AreEqual ( "{ \" s\" : { \" $not\" : /abc / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4258
4258
Assert . AreEqual ( 4 , Consume ( query ) ) ;
4259
4259
}
4260
4260
4261
4261
[ Test ]
4262
- public void TestWhereSEndsWith1 ( )
4262
+ public void TestWhereSEndsWithAbc ( )
4263
4263
{
4264
4264
var query = from c in _collection . AsQueryable < C > ( )
4265
- where c . S . EndsWith ( "1 " )
4265
+ where c . S . EndsWith ( "abc " )
4266
4266
select c ;
4267
4267
4268
4268
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4271,21 +4271,21 @@ where c.S.EndsWith("1")
4271
4271
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4272
4272
4273
4273
var selectQuery = ( SelectQuery ) translatedQuery ;
4274
- Assert . AreEqual ( "(C c) => c.S.EndsWith(\" 1 \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4274
+ Assert . AreEqual ( "(C c) => c.S.EndsWith(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4275
4275
Assert . IsNull ( selectQuery . OrderBy ) ;
4276
4276
Assert . IsNull ( selectQuery . Projection ) ;
4277
4277
Assert . IsNull ( selectQuery . Skip ) ;
4278
4278
Assert . IsNull ( selectQuery . Take ) ;
4279
4279
4280
- Assert . AreEqual ( "{ \" s\" : /1 $/ }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4280
+ Assert . AreEqual ( "{ \" s\" : /abc $/ }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4281
4281
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4282
4282
}
4283
4283
4284
4284
[ Test ]
4285
- public void TestWhereSEndsWith1Not ( )
4285
+ public void TestWhereSEndsWithAbcNot ( )
4286
4286
{
4287
4287
var query = from c in _collection . AsQueryable < C > ( )
4288
- where ! c . S . EndsWith ( "1 " )
4288
+ where ! c . S . EndsWith ( "abc " )
4289
4289
select c ;
4290
4290
4291
4291
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4294,20 +4294,20 @@ public void TestWhereSEndsWith1Not()
4294
4294
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4295
4295
4296
4296
var selectQuery = ( SelectQuery ) translatedQuery ;
4297
- Assert . AreEqual ( "(C c) => !c.S.EndsWith(\" 1 \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4297
+ Assert . AreEqual ( "(C c) => !c.S.EndsWith(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4298
4298
Assert . IsNull ( selectQuery . OrderBy ) ;
4299
4299
Assert . IsNull ( selectQuery . Projection ) ;
4300
4300
Assert . IsNull ( selectQuery . Skip ) ;
4301
4301
Assert . IsNull ( selectQuery . Take ) ;
4302
4302
4303
- Assert . AreEqual ( "{ \" s\" : { \" $not\" : /1 $/ } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4303
+ Assert . AreEqual ( "{ \" s\" : { \" $not\" : /abc $/ } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4304
4304
Assert . AreEqual ( 4 , Consume ( query ) ) ;
4305
4305
}
4306
4306
4307
4307
[ Test ]
4308
4308
public void TestWhereSIsMatch ( )
4309
4309
{
4310
- var regex = new Regex ( @"^x " ) ;
4310
+ var regex = new Regex ( @"^abc " ) ;
4311
4311
var query = from c in _collection . AsQueryable < C > ( )
4312
4312
where regex . IsMatch ( c . S )
4313
4313
select c ;
@@ -4318,20 +4318,20 @@ where regex.IsMatch(c.S)
4318
4318
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4319
4319
4320
4320
var selectQuery = ( SelectQuery ) translatedQuery ;
4321
- Assert . AreEqual ( "(C c) => Regex:(@\" ^x \" ).IsMatch(c.S)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4321
+ Assert . AreEqual ( "(C c) => Regex:(@\" ^abc \" ).IsMatch(c.S)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4322
4322
Assert . IsNull ( selectQuery . OrderBy ) ;
4323
4323
Assert . IsNull ( selectQuery . Projection ) ;
4324
4324
Assert . IsNull ( selectQuery . Skip ) ;
4325
4325
Assert . IsNull ( selectQuery . Take ) ;
4326
4326
4327
- Assert . AreEqual ( "{ \" s\" : /^x / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4327
+ Assert . AreEqual ( "{ \" s\" : /^abc / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4328
4328
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4329
4329
}
4330
4330
4331
4331
[ Test ]
4332
4332
public void TestWhereSIsMatchNot ( )
4333
4333
{
4334
- var regex = new Regex ( @"^x " ) ;
4334
+ var regex = new Regex ( @"^abc " ) ;
4335
4335
var query = from c in _collection . AsQueryable < C > ( )
4336
4336
where ! regex . IsMatch ( c . S )
4337
4337
select c ;
@@ -4342,21 +4342,21 @@ public void TestWhereSIsMatchNot()
4342
4342
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4343
4343
4344
4344
var selectQuery = ( SelectQuery ) translatedQuery ;
4345
- Assert . AreEqual ( "(C c) => !Regex:(@\" ^x \" ).IsMatch(c.S)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4345
+ Assert . AreEqual ( "(C c) => !Regex:(@\" ^abc \" ).IsMatch(c.S)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4346
4346
Assert . IsNull ( selectQuery . OrderBy ) ;
4347
4347
Assert . IsNull ( selectQuery . Projection ) ;
4348
4348
Assert . IsNull ( selectQuery . Skip ) ;
4349
4349
Assert . IsNull ( selectQuery . Take ) ;
4350
4350
4351
- Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^x / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4351
+ Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^abc / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4352
4352
Assert . AreEqual ( 4 , Consume ( query ) ) ;
4353
4353
}
4354
4354
4355
4355
[ Test ]
4356
4356
public void TestWhereSIsMatchStatic ( )
4357
4357
{
4358
4358
var query = from c in _collection . AsQueryable < C > ( )
4359
- where Regex . IsMatch ( c . S , "^x " )
4359
+ where Regex . IsMatch ( c . S , "^abc " )
4360
4360
select c ;
4361
4361
4362
4362
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4365,21 +4365,21 @@ where Regex.IsMatch(c.S, "^x")
4365
4365
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4366
4366
4367
4367
var selectQuery = ( SelectQuery ) translatedQuery ;
4368
- Assert . AreEqual ( "(C c) => Regex.IsMatch(c.S, \" ^x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4368
+ Assert . AreEqual ( "(C c) => Regex.IsMatch(c.S, \" ^abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4369
4369
Assert . IsNull ( selectQuery . OrderBy ) ;
4370
4370
Assert . IsNull ( selectQuery . Projection ) ;
4371
4371
Assert . IsNull ( selectQuery . Skip ) ;
4372
4372
Assert . IsNull ( selectQuery . Take ) ;
4373
4373
4374
- Assert . AreEqual ( "{ \" s\" : /^x / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4374
+ Assert . AreEqual ( "{ \" s\" : /^abc / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4375
4375
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4376
4376
}
4377
4377
4378
4378
[ Test ]
4379
4379
public void TestWhereSIsMatchStaticNot ( )
4380
4380
{
4381
4381
var query = from c in _collection . AsQueryable < C > ( )
4382
- where ! Regex . IsMatch ( c . S , "^x " )
4382
+ where ! Regex . IsMatch ( c . S , "^abc " )
4383
4383
select c ;
4384
4384
4385
4385
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4388,21 +4388,21 @@ public void TestWhereSIsMatchStaticNot()
4388
4388
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4389
4389
4390
4390
var selectQuery = ( SelectQuery ) translatedQuery ;
4391
- Assert . AreEqual ( "(C c) => !Regex.IsMatch(c.S, \" ^x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4391
+ Assert . AreEqual ( "(C c) => !Regex.IsMatch(c.S, \" ^abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4392
4392
Assert . IsNull ( selectQuery . OrderBy ) ;
4393
4393
Assert . IsNull ( selectQuery . Projection ) ;
4394
4394
Assert . IsNull ( selectQuery . Skip ) ;
4395
4395
Assert . IsNull ( selectQuery . Take ) ;
4396
4396
4397
- Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^x / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4397
+ Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^abc / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4398
4398
Assert . AreEqual ( 4 , Consume ( query ) ) ;
4399
4399
}
4400
4400
4401
4401
[ Test ]
4402
4402
public void TestWhereSIsMatchStaticWithOptions ( )
4403
4403
{
4404
4404
var query = from c in _collection . AsQueryable < C > ( )
4405
- where Regex . IsMatch ( c . S , "^x " , RegexOptions . IgnoreCase )
4405
+ where Regex . IsMatch ( c . S , "^abc " , RegexOptions . IgnoreCase )
4406
4406
select c ;
4407
4407
4408
4408
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4411,21 +4411,21 @@ where Regex.IsMatch(c.S, "^x", RegexOptions.IgnoreCase)
4411
4411
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4412
4412
4413
4413
var selectQuery = ( SelectQuery ) translatedQuery ;
4414
- Assert . AreEqual ( "(C c) => Regex.IsMatch(c.S, \" ^x \" , RegexOptions.IgnoreCase)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4414
+ Assert . AreEqual ( "(C c) => Regex.IsMatch(c.S, \" ^abc \" , RegexOptions.IgnoreCase)" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4415
4415
Assert . IsNull ( selectQuery . OrderBy ) ;
4416
4416
Assert . IsNull ( selectQuery . Projection ) ;
4417
4417
Assert . IsNull ( selectQuery . Skip ) ;
4418
4418
Assert . IsNull ( selectQuery . Take ) ;
4419
4419
4420
- Assert . AreEqual ( "{ \" s\" : /^x /i }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4420
+ Assert . AreEqual ( "{ \" s\" : /^abc /i }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4421
4421
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4422
4422
}
4423
4423
4424
4424
[ Test ]
4425
- public void TestWhereSStartsWithX ( )
4425
+ public void TestWhereSStartsWithAbc ( )
4426
4426
{
4427
4427
var query = from c in _collection . AsQueryable < C > ( )
4428
- where c . S . StartsWith ( "x " )
4428
+ where c . S . StartsWith ( "abc " )
4429
4429
select c ;
4430
4430
4431
4431
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4434,21 +4434,21 @@ where c.S.StartsWith("x")
4434
4434
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4435
4435
4436
4436
var selectQuery = ( SelectQuery ) translatedQuery ;
4437
- Assert . AreEqual ( "(C c) => c.S.StartsWith(\" x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4437
+ Assert . AreEqual ( "(C c) => c.S.StartsWith(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4438
4438
Assert . IsNull ( selectQuery . OrderBy ) ;
4439
4439
Assert . IsNull ( selectQuery . Projection ) ;
4440
4440
Assert . IsNull ( selectQuery . Skip ) ;
4441
4441
Assert . IsNull ( selectQuery . Take ) ;
4442
4442
4443
- Assert . AreEqual ( "{ \" s\" : /^x / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4443
+ Assert . AreEqual ( "{ \" s\" : /^abc / }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4444
4444
Assert . AreEqual ( 1 , Consume ( query ) ) ;
4445
4445
}
4446
4446
4447
4447
[ Test ]
4448
- public void TestWhereSStartsWithXNot ( )
4448
+ public void TestWhereSStartsWithAbcNot ( )
4449
4449
{
4450
4450
var query = from c in _collection . AsQueryable < C > ( )
4451
- where ! c . S . StartsWith ( "x " )
4451
+ where ! c . S . StartsWith ( "abc " )
4452
4452
select c ;
4453
4453
4454
4454
var translatedQuery = MongoQueryTranslator . Translate ( query ) ;
@@ -4457,13 +4457,13 @@ public void TestWhereSStartsWithXNot()
4457
4457
Assert . AreSame ( typeof ( C ) , translatedQuery . DocumentType ) ;
4458
4458
4459
4459
var selectQuery = ( SelectQuery ) translatedQuery ;
4460
- Assert . AreEqual ( "(C c) => !c.S.StartsWith(\" x \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4460
+ Assert . AreEqual ( "(C c) => !c.S.StartsWith(\" abc \" )" , ExpressionFormatter . ToString ( selectQuery . Where ) ) ;
4461
4461
Assert . IsNull ( selectQuery . OrderBy ) ;
4462
4462
Assert . IsNull ( selectQuery . Projection ) ;
4463
4463
Assert . IsNull ( selectQuery . Skip ) ;
4464
4464
Assert . IsNull ( selectQuery . Take ) ;
4465
4465
4466
- Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^x / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4466
+ Assert . AreEqual ( "{ \" s\" : { \" $not\" : /^abc / } }" , selectQuery . BuildQuery ( ) . ToJson ( ) ) ;
4467
4467
Assert . AreEqual ( 4 , Consume ( query ) ) ;
4468
4468
}
4469
4469
0 commit comments