public void Allow_2_free_milk_when_8_milk_are_added()
        {
            var item             = new BasketItem(ProductData.Milk, 8);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);

            var actual = basketRepository.ComputeTotals();

            Assert.Equal(6.9M, actual);
        }
        public void Apply_4th_milk_free_offer_when_3_milk_are_added()
        {
            var item             = new BasketItem(ProductData.Milk, 4);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);

            var actual = basketRepository.ComputeTotals();

            Assert.Equal(3.45M, actual);
        }
        public void Apply_50_percent_discount_to_1_bread_when_2_butter_and_bread_are_added()
        {
            var item             = new BasketItem(ProductData.Bread, 1);
            var item2            = new BasketItem(ProductData.Butter, 2);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);
            basketRepository.AddItem(item2);

            var actual = basketRepository.ComputeTotals();

            Assert.Equal(2.10M, actual);
        }
        public void Apply_milk_offer_even_when_basket_contains_none_qualifying_items()
        {
            var item             = new BasketItem(ProductData.Bread, 1);
            var item2            = new BasketItem(ProductData.Milk, 4);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);
            basketRepository.AddItem(item2);

            var actual = basketRepository.ComputeTotals();

            Assert.Equal(4.45M, actual);
        }
        public void Compute_the_total_cost_of_3_different_items_added_to_basket()
        {
            var item             = new BasketItem(ProductData.Bread, 1);
            var item2            = new BasketItem(ProductData.Milk, 1);
            var item3            = new BasketItem(ProductData.Butter, 1);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);
            basketRepository.AddItem(item2);
            basketRepository.AddItem(item3);

            decimal actual = basketRepository.ComputeTotals();

            Assert.Equal(2.95M, actual);
        }
        public void Apply_both_offers_when_basket_contains_qualifying_items()
        {
            var item             = new BasketItem(ProductData.Butter, 2);
            var item2            = new BasketItem(ProductData.Bread, 1);
            var item3            = new BasketItem(ProductData.Milk, 8);
            var basketRepository = new BasketRepository();

            basketRepository.AddItem(item);
            basketRepository.AddItem(item2);
            basketRepository.AddItem(item3);

            var actual = basketRepository.ComputeTotals();

            Assert.Equal(9.0M, actual);
        }