public void mongo_batch_test() { var customerRepo = new MongoTestDB <Customer>(); var custlist = new List <Customer>(new Customer[] { new Customer() { FirstName = "Customer A" }, new Customer() { FirstName = "Client B" }, new Customer() { FirstName = "Customer C" }, new Customer() { FirstName = "Client D" }, new Customer() { FirstName = "Customer E" }, new Customer() { FirstName = "Client F" }, new Customer() { FirstName = "Customer G" }, }); //Insert batch customerRepo.Insert(custlist); var count = customerRepo.GetAll().Count(); count.Should().Be(7); foreach (Customer c in custlist) { c.Id.Should().NotBe(new string('0', 24)); } //Update batch foreach (Customer c in custlist) { c.LastName = c.FirstName; } customerRepo.Update(custlist); var updateList = customerRepo.GetAll(); foreach (Customer c in updateList) { c.LastName.Should().Be(c.FirstName); } //Delete by criteria customerRepo.Delete(f => f.FirstName.StartsWith("Client")); count = customerRepo.GetAll().Count(); count.Should().Be(4); //Delete specific object customerRepo.Delete(custlist[0]); //Test AsQueryable var selectedcustomers = customerRepo.GetBy( cust => cust.LastName.EndsWith("C") || cust.LastName.EndsWith("G")); selectedcustomers.ToList().Count.Should().Be(2); count = customerRepo.GetAll().Count(); count.Should().Be(3); }