public CompositePurchasePolicy(IPurchasePolicy purchasePolicy1, ILogicOperator @operator, IPurchasePolicy purchasePolicy2, string description) { Guid = Guid.NewGuid(); PurchasePolicy1 = purchasePolicy1; Operator = @operator; PurchasePolicy2 = purchasePolicy2; Description = description; }
public bool UpdatePurchasePolicy(string storeName, IPurchasePolicy policy) { if (real == null) { return(true); } return(real.UpdatePurchasePolicy(storeName, policy)); }
public Guid AddNewPurchasePolicy(IPurchasePolicy newPurchasePolicy) { if (PurchasePolicies == null) { PurchasePolicies = new List <IPurchasePolicy>(); } PurchasePolicies.Add(newPurchasePolicy); return(newPurchasePolicy.Guid); }
public Guid AddNewPurchasePolicy(Shop shop, IPurchasePolicy newPurchasePolicy) { if (shop.PurchasePolicies == null) { shop.PurchasePolicies = new List <IPurchasePolicy>(); } shop.PurchasePolicies.Add(newPurchasePolicy); _unitOfWork.ShopRepository.Update(shop); return(newPurchasePolicy.Guid); }
private static void VerifyCartPurchasePolicy(IPurchasePolicy purchasePolicy1, IPurchasePolicy purchasePolicy2) { var expected = (CartPurchasePolicy)purchasePolicy1; var actual = (CartPurchasePolicy)purchasePolicy2; Assert.AreEqual(expected.Guid, actual.Guid); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Operator.ToString(), actual.Operator.ToString()); Assert.AreEqual(expected.ExpectedQuantity, actual.ExpectedQuantity); }
private static void VerifyUserPurchasePolicy(IPurchasePolicy purchasePolicy1, IPurchasePolicy purchasePolicy2) { var expected = (UserPurchasePolicy)purchasePolicy1; var actual = (UserPurchasePolicy)purchasePolicy2; Assert.AreEqual(expected.Guid, actual.Guid); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Value, actual.Value); Assert.AreEqual(expected.FieldName, actual.FieldName); }
private static void VerifyCompositePurchasePolicy(IPurchasePolicy purchasePolicy1, IPurchasePolicy purchasePolicy2) { var expected = (CompositePurchasePolicy)purchasePolicy1; var actual = (CompositePurchasePolicy)purchasePolicy2; Assert.AreEqual(expected.Guid, actual.Guid); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Operator.ToString(), actual.Operator.ToString()); VerifyCartPurchasePolicy(expected.PurchasePolicy1, actual.PurchasePolicy1); VerifyUserPurchasePolicy(expected.PurchasePolicy2, actual.PurchasePolicy2); }
public static bool UpdateStorePolicy(string storeName, IPurchasePolicy newPolicy) { var store = DataHandler.Instance.GetStore(storeName); if (store == null) { return(false); } store.GetPurchasePolicies().Add(newPolicy); return(true); }
private bool policyInCompound(Shop shop, IPurchasePolicy policy) { foreach (IPurchasePolicy p in shop.PurchasePolicies) { if (p.GetType() == typeof(CompositePurchasePolicy)) { if (((CompositePurchasePolicy)p).PurchasePolicy1.Guid.CompareTo(policy.Guid) == 0 || ((CompositePurchasePolicy)p).PurchasePolicy2.Guid.CompareTo(policy.Guid) == 0) { return(true); } } } return(false); }
public bool SetStorePolicy(string userName, string storeName, IPurchasePolicy policy) { throw new NotImplementedException(); }
public bool UpdatePurchasePolicy(string shopName, IPurchasePolicy policy) { return(logicInstance.UpdateStorePolicy(shopName, policy)); }
protected bool UpdatePurchasePolicy(string storeName, IPurchasePolicy policy) { return(service.UpdatePurchasePolicy(storeName, policy)); }
public bool UpdateStorePolicy(string storeName, IPurchasePolicy newPolicy) { return(StoreLogic.UpdateStorePolicy(storeName, newPolicy)); }
public Guid AddNewPurchasePolicy(Guid userGuid, Guid shopGuid, IPurchasePolicy newPolicy) { throw new BadStateException($"Tried to invoke AddNewPurchasePolicy in GuestUser"); }