Ejemplo n.º 1
0
        public void Initialize()
        {
            Product prod_a = new Product("A", 2.00M);
            Product prod_b = new Product("B", 12.00M);
            Product prod_c = new Product("C", 1.25M);
            Product prod_d = new Product("D", 0.15M);

            Inventory inv = new Inventory();

            inv.AddProduct(prod_a.GetCode(), prod_a);
            inv.AddProduct(prod_b.GetCode(), prod_b);
            inv.AddProduct(prod_c.GetCode(), prod_c);
            inv.AddProduct(prod_d.GetCode(), prod_d);

            Discounts disc = new Discounts();

            disc.SetDiscount(prod_a.GetCode(), 4, 7.00M);
            disc.SetDiscount(prod_c.GetCode(), 6, 6.00M);

            DiscountCalculator dc = new DiscountCalculator(inv, disc);

            sc = new ShoppingCart(dc);
        }