Example #1
0
        public void Store_addSimplePurchasePolicy()
        {
            setUp();
            PurchesPolicyData data = new PurchesPolicyData(0, 0, p1.Id, -1, 2, 10, -1, -1, LogicalConnections.and, null, false);

            try
            {
                ProductConditionPolicy p = (ProductConditionPolicy)store.addSimplePurchasePolicy(data);
                Assert.AreEqual(true, p.getId() == 0, "ProductConditionPolicy- id not insert correctly");
            }
            catch (Exception e)
            {
                Assert.AreEqual(true, false, "ProductConditionPolicy-An object of the wrong type was created");
            }

            data = new PurchesPolicyData(1, 0, p1.Id, -1, 5, -1, -1, -1, LogicalConnections.and, null, false);
            try
            {
                inventoryConditionPolicy p = (inventoryConditionPolicy)store.addSimplePurchasePolicy(data);
                Assert.AreEqual(true, p.getId() == 0, "inventoryConditionPolicy- id not insert correctly");
            }
            catch (Exception e)
            {
                Assert.AreEqual(true, false, "inventoryConditionPolicy-An object of the wrong type was created");
            }
            data = new PurchesPolicyData(2, 0, -1, -1, 2, 10, 15, 30, LogicalConnections.and, null, false);
            try
            {
                BuyConditionPolicy p = (BuyConditionPolicy)store.addSimplePurchasePolicy(data);
                Assert.AreEqual(true, p.getId() == 0, "BuyConditionPolicy- id not insert correctly");
            }
            catch (Exception e)
            {
                Assert.AreEqual(true, false, "BuyConditionPolicy-An object of the wrong type was created");
            }
            data = new PurchesPolicyData(3, 0, -1, -1, -1, -1, -1, -1, LogicalConnections.and, "TelAviv", true);
            try
            {
                UserConditionPolicy p = (UserConditionPolicy)store.addSimplePurchasePolicy(data);
                Assert.AreEqual(true, p.getId() == 0, "UserConditionPolicy- id not insert correctly");
            }
            catch (Exception e)
            {
                Assert.AreEqual(true, false, "UserConditionPolicy-An object of the wrong type was created");
            }
        }