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