示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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();
        }
示例#4
0
        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);
        }