コード例 #1
0
        public void apply_all_individual_discounts()
        {
            Products products = new Products();

            AddProduct(products, new Butter(), 2);
            AddProduct(products, new Bread(), 1);
            AddProduct(products, new Milk(), 4);

            Money discount = _discounts.Apply(products);

            var severalDiscountsApplied = 1.65m;

            Assert.Equal(new Money(severalDiscountsApplied), discount);
        }
コード例 #2
0
 public Money Total()
 {
     return(_products.Cost() - _discounts.Apply(_products));
 }