protected override void OnBeforeEachTest()
        {
            var factory = new MessageRouteFactory();
            var routes  = new MessageRoutes
            {
                factory.Create(new[] { GetType().GetTypeInfo().Assembly }, typeof(IHandle <>))
            };

            UnitUnderTest = new MiddlewareEnabledAsyncRouter((t, e) => Activator.CreateInstance(t), routes);
        }
示例#2
0
        protected override void OnBeforeEachTest()
        {
            var factory = new MessageRouteFactory();
            var routes  = new MessageRoutes
            {
                factory.Create(new[] { GetType().GetTypeInfo().Assembly }, typeof(IMessageHandler <>)),
                factory.Create(new[] { GetType().GetTypeInfo().Assembly }, typeof(IRequestHandler <,>))
            };

            UnitUnderTest = new SyncDispatcher((t, e) => Activator.CreateInstance(t), routes);
        }
示例#3
0
        public AsyncDispatcher(MessageHandlerCreator messageHandlerCreator, MessageRoutes messageRoutes)
        {
            if (messageHandlerCreator == null)
            {
                throw new ArgumentNullException(nameof(messageHandlerCreator));
            }

            if (messageRoutes == null)
            {
                throw new ArgumentNullException(nameof(messageRoutes));
            }

            _messageHandlerCreator = messageHandlerCreator;
            _messageRoutes         = messageRoutes;
        }
        public MiddlewareEnabledAsyncMessageRouter(MessageHandlerCreator messageHandlerCreator, MessageRoutes messageRoutes)
        {
            if (messageHandlerCreator == null)
            {
                throw new ArgumentNullException(nameof(messageHandlerCreator));
            }

            if (messageRoutes == null)
            {
                throw new ArgumentNullException(nameof(messageRoutes));
            }

            _messageHandlerCreator = messageHandlerCreator;
            _messageRoutes         = messageRoutes;
            _middlewares           = new Stack <Func <Func <MessageEnvelope, Task>, Func <MessageEnvelope, Task> > >();
        }