public async Task CheckSimpleProductDiscount() { Assert.AreEqual(1000, store.CalcPaySum(shoppingBasket)); await marketRules.CreateSimpleDiscountAsync(store, store.GetFounder().Username, store.GetId(), RuleContext.Product, 0.2, productId : product.Id); Assert.AreEqual(800, store.CalcPaySum(shoppingBasket)); }
//Add New / Complex Discounts public async Task <Guid> AddSimpleDiscountAsync(string username, Guid storeId, RuleContext discountType, double precent, string category = "", Guid productId = new Guid()) { Guid discountId = await marketRules.CreateSimpleDiscountAsync(await MarketStores.Instance.GetStoreById(storeId), username, storeId, discountType, precent, category, productId); await StorePredicatesManager.Instance.SaveRequest(++counter, "CreateSimpleDiscountAsync", username, storeId, discountType, precent, category, productId, discountId); var discountData = new DiscountData(discountId, username, storeId, discountType, RuleType.Simple, precent, category, productId, int.MaxValue, 0, default(DateTime), default(DateTime)); await discountsManager.AddDiscount(discountData); return(discountId); }