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