Example #1
0
        public void GivenDiscountIsAppliedToItemCorrectTotalIsReturned()
        {
            //Arrange
            _discounts.Add(new Discount {
                Sku = "B", Quantity = 3, Value = 40m
            });
            _items.Add(new Item {
                Sku = "B", Price = 15m
            });
            _items.Add(new Item {
                Sku = "B", Price = 15m
            });
            _items.Add(new Item {
                Sku = "B", Price = 15m
            });

            //Act
            _checkout.AddDiscounts(_discounts);
            _checkout.Scan(_items);

            var result = _checkout.Total();

            //Arrange
            Assert.Equal(40m, result);
        }