Beispiel #1
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);
        }
Beispiel #2
0
 public void Checkout(ShoppingCart shoppingCart)
 {
     var order = this.BuildOrder(shoppingCart.Items);
     this.Print(order);
 }