public void CancelChanges_cancels_added_changes() { var context = new OEContext(); var product = new ProductPoco() { Id = 1, Name = "Test product", UnitPrice = 100 }; context.Set <ProductPoco>().Add(product); Assert.AreEqual(true, context.HasChanges()); Assert.AreEqual(1, context.GetChanges().Count()); context.CancelChanges(); Assert.AreEqual(false, context.HasChanges()); Assert.AreEqual(0, context.GetChanges().Count()); }
public void CancelChanges_cancels_attached_modified_changes() { var context = new OEContext(); var product = new Product() { Id = 1, Name = "Test product", UnitPrice = 100 }; context.Set <Product>().Attach(product); product.UnitPrice++; Assert.AreEqual(true, context.HasChanges()); Assert.AreEqual(1, context.GetChanges().Count()); context.CancelChanges(); Assert.AreEqual(false, context.HasChanges()); Assert.AreEqual(0, context.GetChanges().Count()); }