Exemplo n.º 1
0
        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>());
        }