Пример #1
0
        public static void Main()
        {
            IStockTrade receiver = new StockTrade("MSFT", 1200);
            OrderCommand buyCommand = new BuyOrderCommand(receiver);
            OrderCommand sellCommand = new SellOrderCommand(receiver);
            Agent agent = new Agent();

            agent.PlaceOrder(buyCommand);
            agent.PlaceOrder(buyCommand);
            agent.PlaceOrder(buyCommand);

            agent.ExecuteOrder();

            agent.Revert(3);
        }
Пример #2
0
        public static void Main()
        {
            IStockTrade  receiver    = new StockTrade("MSFT", 1200);
            OrderCommand buyCommand  = new BuyOrderCommand(receiver);
            OrderCommand sellCommand = new SellOrderCommand(receiver);
            Agent        agent       = new Agent();

            agent.PlaceOrder(buyCommand);
            agent.PlaceOrder(buyCommand);
            agent.PlaceOrder(buyCommand);

            agent.ExecuteOrder();

            agent.Revert(3);
        }
Пример #3
0
        static void Main(string[] args)
        {
            //setup our DI
            IServiceCollection serviceProvider = new ServiceCollection();

            serviceProvider.AddMediatR(typeof(OrderHandlers));
            var providerInstance = serviceProvider.BuildServiceProvider();



            //do the actual work here
            var mediator = providerInstance.GetService <IMediator>();

            _mediator = mediator;

            var buyCommand  = new BuyOrderCommand();
            var sellCommand = new SellOrderCommand();

            var         buyResponse  = _mediator.Send(buyCommand);
            var         sellResponse = _mediator.Send(sellCommand);
            ITraderInfo info         = new TraderInfoAppService();

            Debug.WriteLine("Coucou");
        }