public void init() { WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB(); cDB.emptyDB(); configuration.DB_MODE = testing; PPDB = new PurchasePolicyDB(testing); li = new LinkedList <PurchasePolicy>(); PurchasePolicy temp = new PurchasePolicy(); temp.TypeOfPolicy = 1; temp.ProductName = "milk"; temp.StoreId = 1; temp.Category = ""; temp.ProductInStoreId = 1; temp.Country = ""; PPDB.Add(temp); }
public void AddPurchasePolicy() { try { PurchasePolicy toAdd = new PurchasePolicy(); toAdd.TypeOfPolicy = 1; toAdd.ProductName = "meat"; toAdd.StoreId = 1; toAdd.Category = ""; toAdd.ProductInStoreId = 2; toAdd.Country = "ISRAEL"; PPDB.Add(toAdd); li = PPDB.Get(); Assert.AreEqual(li.Count, 2); } catch (Exception e) { Assert.AreEqual(true, false, "there was a connection error to the testing db"); } }
// ========================= AMOUNT CONSTRAINTS !!!! ================================================ public int setAmountPolicyOnProduct(string productName, int minAmount, int maxAmount) { // 1-Product(system level) , 2- Store, 3-category, 4- product in store, 5-country PurchasePolicy toAdd = new PurchasePolicy(); toAdd.TypeOfPolicy = 1; toAdd.ProductName = productName; toAdd.MinAmount = minAmount; toAdd.MaxAmount = maxAmount; toAdd.NoLimit = false; ppDB.Add(toAdd); policys.AddLast(toAdd); return(1); }