public void FourCanOfBeansPrice() { DiscountSuit suit = new DiscountSuit(3, 1.0); Price price = new Price(4, 0.65); BuyingItem buyingItem = new BuyingItem("Beans", suit, price); Assert.AreEqual(1.65, buyingItem.getPrice()); }
private double HavingSuit(DiscountSuit suit) { return(quantity / suit.DiscountQuantity); }
private double SingleItemAfterSuit(DiscountSuit suit) { return(quantity % suit.DiscountQuantity); }
public double getPrice(DiscountSuit suit) { return(Math.Round(HavingSuit(suit)) * suit.DiscountPrice + Math.Round(SingleItemAfterSuit(suit)) * singlePrice); }
public BuyingItem(string name, DiscountSuit suit, Price price) { this.discountSuit = suit; this.price = price; }