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