Пример #1
0
        public ProductPrice Apply(ProductPrice productPrice, int productCount)
        {
            var specialOffersCount   = productCount / Amount;
            var priceWithoutDiscount = productCount * productPrice;
            var perOfferDiscount     = Amount * productPrice - TotalPrice;

            return(priceWithoutDiscount - (specialOffersCount > 0 ? specialOffersCount * perOfferDiscount : 0));
        }
Пример #2
0
 public VolumedSpecialOffer(int amount, ProductPrice totalPrice)
 {
     Amount     = amount;
     TotalPrice = totalPrice;
 }
Пример #3
0
 public Product(ProductCode code, ProductPrice price, ISpecialOffer specialOffer)
 {
     Code         = code;
     Price        = price;
     SpecialOffer = specialOffer;
 }
Пример #4
0
 public void ChangePrice(ProductPrice price)
 {
     Price = price;
 }
Пример #5
0
 public Product(ProductCode code, ProductPrice price) : this(code, price, new EmptySpecialOffer())
 {
 }