コード例 #1
0
        public void When_2_bread_2_butter_in_basket_total_should_be_310()
        {
            //arrange
            var basket = new Basket();

            basket.Items.Add(new Bread(2));
            basket.Items.Add(new Butter(2));
            var pricelistProvider = new PriceProvider();
            var sut = new BasketCalculator(pricelistProvider);
            //act
            var result = sut.CalculateBasketPrice(basket);

            //assert
            Assert.AreEqual(3.1, result);
        }
コード例 #2
0
        public void When_4_milk_in_basket_total_should_be_345()
        {
            //arrange
            var basket = new Basket();

            basket.Items.Add(new Milk(4));

            var pricelistProvider = new PriceProvider();
            var sut = new BasketCalculator(pricelistProvider);
            //act
            var result = sut.CalculateBasketPrice(basket);

            //assert
            Assert.AreEqual(3.45, result);
        }
コード例 #3
0
        public void When_1_bread_1_milk_1_butter_in_basket_total_should_be_295()
        {
            //arrange
            var basket = new Basket();

            basket.Items.Add(new Milk(1));
            basket.Items.Add(new Bread(1));
            basket.Items.Add(new Butter(1));
            var pricelistProvider = new PriceProvider();
            var sut = new BasketCalculator(pricelistProvider);
            //act
            var result = sut.CalculateBasketPrice(basket);

            //assert
            Assert.AreEqual(2.95, result);
        }