private decimal GetPrice(List <int> basket, int numberOfBooksInSeries) { // group identical items in basket var groupedBasket = _basketHelper.GetBasketAggregation(basket, numberOfBooksInSeries); // get all combinations for consideration var allCombos = _basketSplitter.GetBasketCombinations(groupedBasket, numberOfBooksInSeries); // return the lowest price return(_priceCalculator.GetLowestPrice(allCombos)); }
public void GetLowestPrice_WhenCalledWithBasketCombinationsMultiple1_ReturnsCorrectPrice() { var basketItems = new List <int>() { 1, 1, 2, 2, 3, 3, 4, 5 }; var booksInSeries = 5; var groupedBasket = _basketHelper.GetBasketAggregation(basketItems, booksInSeries); var allCombos = _basketSplitter.GetBasketCombinations(groupedBasket, booksInSeries); var price = _priceCalculator.GetLowestPrice(allCombos); Assert.AreEqual(51.2m, price); }