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); }
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(); }
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(); }