Beispiel #1
0
        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());
        }
Beispiel #2
0
 private double HavingSuit(DiscountSuit suit)
 {
     return(quantity / suit.DiscountQuantity);
 }
Beispiel #3
0
 private double SingleItemAfterSuit(DiscountSuit suit)
 {
     return(quantity % suit.DiscountQuantity);
 }
Beispiel #4
0
 public double getPrice(DiscountSuit suit)
 {
     return(Math.Round(HavingSuit(suit)) * suit.DiscountPrice + Math.Round(SingleItemAfterSuit(suit)) * singlePrice);
 }
Beispiel #5
0
 public BuyingItem(string name, DiscountSuit suit, Price price)
 {
     this.discountSuit = suit;
     this.price        = price;
 }