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