Beispiel #1
0
        public void should_not_hang_when_running_invoker_synchronously_in_same_dispatch_queue()
        {
            _messageDispatcher.ConfigureHandlerFilter(x => x == typeof(ForwardCommandHandler) || x == typeof(SyncCommandHandlerWithQueueName1));
            _messageDispatcher.LoadMessageHandlerInvokers();

            var handler1 = new ForwardCommandHandler {
                Action = x => Dispatch(new DispatchCommand(), x)
            };

            _containerMock.Setup(x => x.GetInstance(typeof(ForwardCommandHandler))).Returns(handler1);

            var handler2 = new SyncCommandHandlerWithQueueName1();

            _containerMock.Setup(x => x.GetInstance(typeof(SyncCommandHandlerWithQueueName1))).Returns(handler2);

            Dispatch(new ForwardCommand());

            Wait.Until(() => handler2.HandleStopped, 1000.Milliseconds());
        }
        public void should_not_hang_when_running_invoker_synchronously_in_same_dispatch_queue()
        {
            _messageDispatcher.ConfigureHandlerFilter(x => x == typeof(ForwardCommandHandler) || x == typeof(SyncCommandHandlerWithQueueName1));
            _messageDispatcher.LoadMessageHandlerInvokers();

            var handler1 = new ForwardCommandHandler { Action = x => Dispatch(new DispatchCommand(), x) };
            _containerMock.Setup(x => x.GetInstance(typeof(ForwardCommandHandler))).Returns(handler1);

            var handler2 = new SyncCommandHandlerWithQueueName1();
            _containerMock.Setup(x => x.GetInstance(typeof(SyncCommandHandlerWithQueueName1))).Returns(handler2);

            Dispatch(new ForwardCommand());

            Wait.Until(() => handler2.HandleStopped, 1000.Milliseconds());
        }