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

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

            Assert.AreEqual(new decimal(23.2), calculatorPrices);
        }
示例#3
0
        public void FinalGoal()
        {
            decimal calculatorPrices = DiscountViaRecursionService.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 = DiscountViaRecursionService.CalculateCheapestPrice(_discounts, productList.ToList());

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

            Assert.AreEqual(expectedPrice, calculatorPrices);
        }