Ejemplo n.º 1
0
        public void Setup()
        {
            _containerMock = new Mock <IContainer>();
            _containerMock.Setup(x => x.GetInstance(It.IsAny <Type>())).Returns <Type>(Activator.CreateInstance);

            _invocation      = null;
            _pipeManagerMock = new Mock <IPipeManager>();
            _pipeManagerMock.Setup(x => x.BuildPipeInvocation(It.IsAny <IMessageHandlerInvoker>(), It.IsAny <IMessage>(), It.IsAny <MessageContext>()))
            .Returns <IMessageHandlerInvoker, IMessage, MessageContext>((invoker, message, messageContext) =>
            {
                _invocation = new TestPipeInvocation(message, messageContext, invoker);
                return(_invocation);
            });

            _taskSchedulerFactory = new DispatcherTaskSchedulerFactory();

            _messageDispatcher = CreateAndStartDispatcher(_taskSchedulerFactory);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            _containerMock = new Mock<IContainer>();
            _containerMock.Setup(x => x.GetInstance(It.IsAny<Type>())).Returns<Type>(Activator.CreateInstance);

            _invocation = null;
            _pipeManagerMock = new Mock<IPipeManager>();
            _pipeManagerMock.Setup(x => x.BuildPipeInvocation(It.IsAny<IMessageHandlerInvoker>(), It.IsAny<IMessage>(), It.IsAny<MessageContext>()))
                            .Returns<IMessageHandlerInvoker, IMessage, MessageContext>((invoker, message, messageContext) =>
                            {
                                _invocation = new TestPipeInvocation(message, messageContext, invoker);
                                return _invocation;
                            });

            _taskSchedulerFactory = new DispatcherTaskSchedulerFactory();

            _messageDispatcher = CreateAndStartDispatcher(_taskSchedulerFactory);
        }