public void BulkUpdate() { TestDbContext dbContext = new TestDbContext(); SetupData(dbContext, true); var orders = dbContext.Orders.Where(o => o.Price == 1.25M).OrderBy(o => o.Id).ToList(); long maxId = 0; foreach (var order in orders) { order.Price = 2.35M; maxId = order.Id; } int rowsUpdated = dbContext.BulkUpdate(orders); var newOrders = dbContext.Orders.Where(o => o.Price == 2.35M).OrderBy(o => o.Id).Count(); int entitiesWithChanges = dbContext.ChangeTracker.Entries().Where(t => t.State == EntityState.Modified).Count(); Assert.IsTrue(orders.Count > 0, "There must be orders in database that match this condition (Price = $1.25)"); Assert.IsTrue(rowsUpdated == orders.Count, "The number of rows updated must match the count of entities that were retrieved"); Assert.IsTrue(newOrders == rowsUpdated, "The count of new orders must be equal the number of rows updated in the database."); //Assert.IsTrue(entitiesWithChanges == 0, "There should be no pending Order entities with changes after BulkInsert completes"); }