public void Order_Remove_Deletes_Should_Remove_Deleted_OrderDetails() { // Arrange var database = new MockNorthwind(); var order = database.Orders[0]; var deleted1 = order.OrderDetails[0]; var deleted2 = order.OrderDetails[2]; var changeTracker = new ChangeTrackingCollection <Order>(order); order.OrderDetails.Remove(deleted1); order.OrderDetails.Remove(deleted2); changeTracker.RestoreDeletes(); // Act changeTracker.RemoveRestoredDeletes(); // Assert Assert.AreEqual(1, order.OrderDetails.Count); Assert.That(changeTracker, Has.No.Member(deleted1)); Assert.That(changeTracker, Has.No.Member(deleted2)); }
public void Order_Remove_Deletes_Should_Remove_Deleted_OrderDetails() { // Arrange var database = new MockNorthwind(); var order = database.Orders[0]; var deleted1 = order.OrderDetails[0]; var deleted2 = order.OrderDetails[2]; var changeTracker = new ChangeTrackingCollection <Order>(order); order.OrderDetails.Remove(deleted1); order.OrderDetails.Remove(deleted2); changeTracker.RestoreDeletes(); // Act changeTracker.RemoveRestoredDeletes(); // Assert Assert.Equal(1, order.OrderDetails.Count); Assert.DoesNotContain(deleted1, changeTracker.Cast <object>()); Assert.DoesNotContain(deleted2, changeTracker.Cast <object>()); }