Exemple #1
0
        static void Main(string[] args)
        {
            var stock = new StockTrade();

            var bsc = new BuysStockOrder(stock);
            var ssc = new SellStockOrder(stock);

            var agent = new Agent();

            agent.PlaceOrder(bsc);
            agent.PlaceOrder(ssc);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var stock = new StockTrade();

            var bsc = new BuysStockOrder(stock);
            var ssc = new SellStockOrder(stock);

            var agent = new Agent();

            agent.PlaceOrder(bsc);
            agent.PlaceOrder(ssc);
        }
Exemple #3
0
        public void Start()
        {
            StockTrade st        = new StockTrade();
            Command    buyStock  = new BuyStockOrder(st);
            Command    sellStock = new SellStockOrder(st);
            Agent      agent     = new Agent();

            agent.SetCommand(buyStock);
            agent.SetCommand(sellStock);

            agent.DoAction();
            agent.Undo();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Stock stock = new Stock();

            BuyStockOrder  buyStockOrder  = new BuyStockOrder(stock);
            SellStockOrder sellStockOrder = new SellStockOrder(stock);

            Broker broker = new Broker();

            broker.TakeOrder(buyStockOrder);
            broker.TakeOrder(sellStockOrder);

            broker.PlaceOrders();

            Console.ReadLine();
        }