public void Input1()
        {
            //Arrange
            decimal bookPriceExpected         = 12.49m;
            decimal musicCdPriceExpected      = 16.49m;
            decimal chocolateBarPriceExpected = 0.85m;
            decimal salesTaxExpected          = 1.50m;
            decimal totalExpected             = 29.83m;

            string[] inputLines = new string[]
            {
                "1 book at 12.49",
                "1 music CD at 14.99",
                "1 chocolate bar at 0.85"
            };

            //Act
            ShoppingBasket       shoppingBasket = _shoppingBasketCreator.CreateShoppingBasket(inputLines, _productCategories);
            IList <TaxedProduct> taxedProducts  = _taxCalculator.ApplyTaxes(shoppingBasket);
            ReceiptDetail        receiptDetail  = _receiptDetailCreator.CreateReceiptDetail(taxedProducts);

            //Assert
            Assert.AreEqual($"1 book: {bookPriceExpected}{Environment.NewLine}" +
                            $"1 music CD: {musicCdPriceExpected}{Environment.NewLine}" +
                            $"1 chocolate bar: {chocolateBarPriceExpected}{Environment.NewLine}" +
                            $"Sales Taxes: {salesTaxExpected}{Environment.NewLine}" +
                            $"Total: {totalExpected}{Environment.NewLine}", receiptDetail.Receipt);
        }
Exemple #2
0
        public void ApplyTaxes_EmptyShoppingBasket_NoTaxedProducts()
        {
            //Arrange
            var shoppingBasket = new ShoppingBasket(new List <IProduct>());

            //Act
            IList <TaxedProduct> taxedProducts = _taxCalculator.ApplyTaxes(shoppingBasket);

            //Assert
            Assert.AreEqual(0, taxedProducts.Count);
        }