コード例 #1
0
        public void GivenOneItemReturns8()
        {
            decimal calculatorPrices = DiscountService.CalculateCheapestPrice(_discounts, new List <int> {
                1
            });

            Assert.AreEqual(new decimal(8.0), calculatorPrices);
        }
コード例 #2
0
        public void GivenOneSetOfItemsAndOneDuplicateReturnsOneSetPriceAndOneNormal()
        {
            decimal calculatorPrices = DiscountService.CalculateCheapestPrice(_discounts, new List <int> {
                1, 2, 2
            });

            Assert.AreEqual(new decimal(23.2), calculatorPrices);
        }
コード例 #3
0
        public void FinalGoal()
        {
            decimal calculatorPrices = DiscountService.CalculateCheapestPrice(_discounts, new List <int> {
                1, 1, 2, 2, 3, 3, 4, 5
            });

            Assert.AreEqual(new decimal(51.20), calculatorPrices);
        }
コード例 #4
0
        public void MakeSureDiscountsCanBeAppliedWhenDuplicatesAreAtTheStartOfTheProductList(int[] productList, decimal expectedPrice)
        {
            decimal calculatorPrices = DiscountService.CalculateCheapestPrice(_discounts, productList.ToList());

            Assert.AreEqual(expectedPrice, calculatorPrices);
        }
コード例 #5
0
        public void GivenItemsReturnsExpectedPrice(int[] productList, decimal expectedPrice)
        {
            decimal calculatorPrices = DiscountService.CalculateCheapestPrice(_discounts, productList.ToList());

            Assert.AreEqual(expectedPrice, calculatorPrices);
        }