Exemplo n.º 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));
        }
Exemplo n.º 2
0
 public VolumedSpecialOffer(int amount, ProductPrice totalPrice)
 {
     Amount     = amount;
     TotalPrice = totalPrice;
 }
Exemplo n.º 3
0
 public Product(ProductCode code, ProductPrice price, ISpecialOffer specialOffer)
 {
     Code         = code;
     Price        = price;
     SpecialOffer = specialOffer;
 }
Exemplo n.º 4
0
 public void ChangePrice(ProductPrice price)
 {
     Price = price;
 }
Exemplo n.º 5
0
 public Product(ProductCode code, ProductPrice price) : this(code, price, new EmptySpecialOffer())
 {
 }