public void Acc_BatchSaveInsert() { ProductCollection c = CreateProductCollection(); c.BatchSave(); c = new ProductCollection(); c.Load(ReadOnlyRecord <Product> .FetchByParameter(Product.Columns.ProductName, Comparison.Like, "Unit Test Product%")); Assert.AreEqual(1000, c.Count, "Expected 1000 - After Save: " + c.Count); }
public void BatchSaveUpdateNoChanges() { ProductCollection c = CreateProductCollection(); c.BatchSave(); c = FetchProductCollection(); foreach (Product product in c) { product.UnitsOnOrder = product.UnitsOnOrder; } c.BatchSave(); c = FetchProductCollection(); Assert.AreEqual(1000, c.Count, "Expected 1000 - After Save: " + c.Count); foreach (Product product in c) { Assert.AreEqual((Int16)9, product.UnitsOnOrder, product.ProductName); } }
public void Acc_BatchSaveUpdate() { ProductCollection c = CreateProductCollection(); c.BatchSave(); c = FetchProductCollection(); foreach (Product product in c) { product.UnitsOnOrder = 888; } c.BatchSave(); c = FetchProductCollection(); Assert.AreEqual(1000, c.Count, "Expected 1000 - After Update: " + c.Count); foreach (Product product in c) { Assert.AreEqual((Int16)888, product.UnitsOnOrder, product.ProductName); } RemoveProductCollection(); }
public void Acc_DeferredDelete() { ProductCollection c = CreateProductCollection(); c.BatchSave(); c = new ProductCollection(); c.Load(ReadOnlyRecord <Product> .FetchByParameter(Product.Columns.ProductName, Comparison.Like, "Unit Test Product%")); Assert.AreEqual(1000, c.Count, "Expected 1000 - After Save: " + c.Count); while (c.Count > 0) { c.RemoveAt(0); // RemoveItem() gets called } c.SaveAll(); c = new ProductCollection(); c.Load(ReadOnlyRecord <Product> .FetchByParameter(Product.Columns.ProductName, Comparison.Like, "Unit Test Product%")); Assert.AreEqual(0, c.Count, "Expected 0 - After Save: " + c.Count); }