コード例 #1
0
        public void BatchPriceCalculatedCorrectly(string productsString, decimal expectedTotalPrice)
        {
            var products = ProductHelper.GetProducts(productsString);
            var offer    = new BreadAndButterOffer();
            var result   = offer.Process(products);

            Assert.Equal(expectedTotalPrice, result.lineItems.Sum(li => li.Price));
        }
コード例 #2
0
        public void ReturnsLineItemsAndRemainingProductsForEachFullBatch(string productsString, int expectedLineItemsCount, int expectedRemaining)
        {
            var products = ProductHelper.GetProducts(productsString);
            var offer    = new BreadAndButterOffer();
            var result   = offer.Process(products);

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