@@ -246,23 +246,6 @@ public void TestBulkDelete()
246
246
Assert . AreEqual ( 2 , _collection . FindOne ( ) [ "x" ] . ToInt32 ( ) ) ;
247
247
}
248
248
249
- [ Test ]
250
- public void TestBulkEmpty ( )
251
- {
252
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
253
- Assert . Throws < InvalidOperationException > ( ( ) => bulk . Execute ( ) ) ;
254
- }
255
-
256
- [ Test ]
257
- public void TestBulkExecuteTwice ( )
258
- {
259
- _collection . Drop ( ) ;
260
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
261
- bulk . Insert ( new BsonDocument ( ) ) ;
262
- bulk . Execute ( ) ;
263
- Assert . Throws < InvalidOperationException > ( ( ) => bulk . Execute ( ) ) ;
264
- }
265
-
266
249
[ Test ]
267
250
public void TestBulkInsert ( )
268
251
{
@@ -1261,114 +1244,6 @@ public void TestFindWithMaxTime()
1261
1244
}
1262
1245
}
1263
1246
1264
- [ Test ]
1265
- public void TestFluentBulkDelete ( )
1266
- {
1267
- _collection . Drop ( ) ;
1268
- _collection . Insert ( new BsonDocument ( "x" , 1 ) ) ;
1269
- _collection . Insert ( new BsonDocument ( "x" , 2 ) ) ;
1270
- _collection . Insert ( new BsonDocument ( "x" , 3 ) ) ;
1271
-
1272
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1273
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . RemoveOne ( ) ;
1274
- bulk . Find ( Query . EQ ( "x" , 3 ) ) . RemoveOne ( ) ;
1275
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1276
-
1277
- Assert . AreEqual ( 1 , _collection . Count ( ) ) ;
1278
- Assert . AreEqual ( 2 , _collection . FindOne ( ) [ "x" ] . ToInt32 ( ) ) ;
1279
- }
1280
-
1281
- [ Test ]
1282
- public void TestFluentBulkDeleteMissingQuery ( )
1283
- {
1284
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1285
- Assert . Throws < ArgumentNullException > ( ( ) => bulk . Find ( null ) ) ;
1286
- }
1287
-
1288
- [ Test ]
1289
- public void TestFluentBulkInsert ( )
1290
- {
1291
- _collection . Drop ( ) ;
1292
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1293
- bulk . Insert ( new BsonDocument ( "x" , 1 ) ) ;
1294
- bulk . Insert ( new BsonDocument ( "x" , 2 ) ) ;
1295
- bulk . Insert ( new BsonDocument ( "x" , 3 ) ) ;
1296
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1297
-
1298
- Assert . AreEqual ( 3 , _collection . Count ( ) ) ;
1299
- }
1300
-
1301
- [ Test ]
1302
- public void TestFluentBulkUpdate ( )
1303
- {
1304
- _collection . Drop ( ) ;
1305
- _collection . Insert ( new BsonDocument ( "x" , 1 ) ) ;
1306
- _collection . Insert ( new BsonDocument ( "x" , 2 ) ) ;
1307
- _collection . Insert ( new BsonDocument ( "x" , 3 ) ) ;
1308
-
1309
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1310
- bulk . Find ( Query . GT ( "x" , 0 ) ) . Update ( Update . Set ( "z" , 1 ) ) ;
1311
- bulk . Find ( Query . EQ ( "x" , 3 ) ) . UpdateOne ( Update . Set ( "z" , 3 ) ) ;
1312
- bulk . Find ( Query . EQ ( "x" , 4 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "z" , 4 ) ) ;
1313
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1314
-
1315
- Assert . AreEqual ( 4 , _collection . Count ( ) ) ;
1316
- foreach ( var document in _collection . FindAll ( ) )
1317
- {
1318
- var x = document [ "x" ] . ToInt32 ( ) ;
1319
- var z = document [ "z" ] . ToInt32 ( ) ;
1320
- var expected = ( x == 2 ) ? 1 : x ;
1321
- Assert . AreEqual ( expected , z ) ;
1322
- }
1323
- }
1324
-
1325
- [ Test ]
1326
- public void TestFluentBulkWrite ( )
1327
- {
1328
- _collection . Drop ( ) ;
1329
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1330
- bulk . Insert ( new BsonDocument ( "x" , 1 ) ) ;
1331
- bulk . Insert ( new BsonDocument ( "x" , 2 ) ) ;
1332
- bulk . Insert ( new BsonDocument ( "x" , 3 ) ) ;
1333
- bulk . Insert ( new BsonDocument ( "x" , 4 ) ) ;
1334
- bulk . Find ( Query . GT ( "x" , 2 ) ) . Update ( Update . Inc ( "x" , 10 ) ) ;
1335
- bulk . Find ( Query . EQ ( "x" , 13 ) ) . RemoveOne ( ) ;
1336
- bulk . Find ( Query . EQ ( "x" , 14 ) ) . RemoveOne ( ) ;
1337
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1338
-
1339
- Assert . AreEqual ( 2 , _collection . Count ( ) ) ;
1340
- }
1341
-
1342
- [ Test ]
1343
- public void TestBulkFluentWriteOrdered ( )
1344
- {
1345
- _collection . Drop ( ) ;
1346
- var bulk = _collection . InitializeOrderedBulkOperation ( ) ;
1347
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1348
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . RemoveOne ( ) ;
1349
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1350
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . RemoveOne ( ) ;
1351
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1352
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1353
-
1354
- Assert . AreEqual ( 1 , _collection . Count ( ) ) ;
1355
- }
1356
-
1357
- [ Test ]
1358
- public void TestFluentBulkWriteUnordered ( )
1359
- {
1360
- _collection . Drop ( ) ;
1361
- var bulk = _collection . InitializeUnorderedBulkOperation ( ) ;
1362
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1363
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . RemoveOne ( ) ;
1364
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1365
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . RemoveOne ( ) ;
1366
- bulk . Find ( Query . EQ ( "x" , 1 ) ) . Upsert ( ) . UpdateOne ( Update . Set ( "y" , 1 ) ) ;
1367
- var result = bulk . Execute ( WriteConcern . Acknowledged ) ;
1368
-
1369
- Assert . AreEqual ( 0 , _collection . Count ( ) ) ;
1370
- }
1371
-
1372
1247
#pragma warning disable 649 // never assigned to
1373
1248
private class Place
1374
1249
{
0 commit comments