Esempio n. 1
0
        private void PrintCart(ShoppingCartRepository shoppingCartRepository)
        {
            _testOutputHelper.WriteLine("**************************");

            var totalPrice = 0m;

            foreach (var lineItem in shoppingCartRepository.All())
            {
                var price = lineItem.Value.product.Price * lineItem.Value.Quantity;

                _testOutputHelper.WriteLine($"{lineItem.Key} " +
                                            $"£{lineItem.Value.product.Price} x {lineItem.Value.Quantity} = ${price}");

                totalPrice += price;
            }

            _testOutputHelper.WriteLine($"Total price:\t${totalPrice}");
        }