Esempio n. 1
0
 public void Buy(Product item)
 {
     this.Items.Add(item);
 }
Esempio n. 2
0
        public void Remove(Product item)
        {
            var itemToRemove = this.Items.LastOrDefault(i => i.Name.Equals(item.Name));

            if (itemToRemove != null)
            {
                this.Items.Remove(itemToRemove);
            }
        }
Esempio n. 3
0
        public void BuyProducts()
        {
            var importedCD = new Product("imported CD", 10.99m, SalesTaxType.Default, DutyTaxType.Import);
            var perfume = new Product("perfume", 19.99m, SalesTaxType.Default, DutyTaxType.Domestic);
            var headachePills = new Product("headache pills", 4.65m, SalesTaxType.Medical, DutyTaxType.Domestic);
            var importedChocolates = new Product("imported chocolates", 16.45m, SalesTaxType.Food, DutyTaxType.Import);

            ShoppingCart shoppingCart = new ShoppingCart();

            shoppingCart.Buy(importedCD);
            shoppingCart.Buy(perfume);
            shoppingCart.Buy(headachePills);
            shoppingCart.Buy(importedChocolates);

            // Cashier is automatic injected by MEF.
            //Cashier cashier = new Cashier();
            this._cashier.Checkout(shoppingCart);
        }