public void AddDiscountSuccess() { try { VisibleDiscount v = new VisibleDiscount(0.2, "12/12/2020", "StoreVisibleDiscount", store1.getStoreID()); dbdiscount.addDiscount(v); DiscountComponent d = dbdiscount.getDiscountByID(v.getId()); Assert.IsTrue(d.getId() == v.getId()); } catch (Exception) { Assert.Fail(); } }
public void RemoveDiscount() { try { VisibleDiscount v = new VisibleDiscount(0.2, "12/12/2020", "StoreVisibleDiscount", store1.getStoreID()); dbdiscount.addDiscount(v); dbdiscount.removeDiscount(v); DiscountComponent d = dbdiscount.getDiscountByID(v.getId()); Assert.AreEqual(d, null); } catch (Exception e) { Assert.Fail(e.Message); } }
public void InitiateScreen(GoodsPriceComponent offerGoodsPrice, DiscountComponent personalOfferDiscount, RentTankRole tankRole, ShopDialogs shopDialogs) { base.shopDialogs = shopDialogs; if (personalOfferDiscount.DiscountCoeff <= 0f) { this.actualPrice.text = offerGoodsPrice.Price + " " + offerGoodsPrice.Currency; this.SetDiscountObjects(false); } else { float num = this.RoundPrice(offerGoodsPrice.Price * (1f - personalOfferDiscount.DiscountCoeff)); this.actualPrice.text = num + " " + offerGoodsPrice.Currency; this.priceWithoutDiscount.text = offerGoodsPrice.Price.ToString(CultureInfo.InvariantCulture); this.discount.text = $"-{personalOfferDiscount.DiscountCoeff * 100f}%"; this.SetDiscountObjects(true); } this.SetWindowContent(tankRole); }