Example #1
0
        public void BatchPriceCalculatedCorrectly(string productsString, int batchSize, decimal expectedTotalPrice)
        {
            var products = ProductHelper.GetProducts(productsString);
            var offer    = new SingleProductBulkOffer(products.First().Name, batchSize);
            var result   = offer.Process(products);

            Assert.Equal(expectedTotalPrice, result.lineItems.Sum(li => li.Price));
        }
Example #2
0
        public void ReturnsLineItemsAndRemainingProductsForEachFullBatch(string productsString, int batchSize, int expectedLineItemsCount, int expectedRemaining)
        {
            var products = ProductHelper.GetProducts(productsString);
            var offer    = new SingleProductBulkOffer(products.First().Name, batchSize);
            var result   = offer.Process(products);

            Assert.Equal(expectedLineItemsCount, result.lineItems.Count());
            Assert.Equal(expectedRemaining, result.remainingProducts.Count());
        }