Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var modifyPrice = new ModifyPrice();
            var product     = new Product("Phone", 500);

            Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Increase, 100));
            Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Increase, 50));
            Execute(product, modifyPrice, new ProductCommand(product, PriceAction.Decrease, 25));

            Console.WriteLine(product);
        }
Ejemplo n.º 2
0
 private static void Execute(Product product, ModifyPrice modifyPrice, ProductCommand productCommand)
 {
     modifyPrice.SetCommand(productCommand);
     modifyPrice.Invoke();
 }