Пример #1
0
        /// <summary>
        /// Fetches the product collection.
        /// </summary>
        /// <returns></returns>
        private static ProductCollection FetchProductCollection()
        {
            ProductCollection c = new ProductCollection();

            c.Load(ReadOnlyRecord <Product> .FetchByParameter(Product.Columns.ProductName, Comparison.Like, "Unit Test Product%"));
            return(c);
        }
Пример #2
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);
        }
Пример #3
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);
        }