示例#1
0
 /// <summary>
 /// Registers a <see cref="ITopicHandler{TEvent}"/>
 /// </summary>
 /// <typeparam name="TTopic">Type of the topic message</typeparam>
 /// <param name="handler">Topic message handler</param>
 public void Register <TTopic>(IAsyncTopicHandler <TTopic> handler)
 {
     Validate <TTopic>();
     handlers.Add(
         typeof(TTopic),
         eventMessage => handler.Handle((TTopic)eventMessage));
 }
示例#2
0
 public void Setup()
 {
     subscriber   = mockSubscriber.Object;
     handler      = mockHandler.Object;
     asyncHandler = mockAsyncHandler.Object;
     container    = mockContainer.Object;
 }
示例#3
0
 public IHandlerSetup WithTopicHandler <TTopic, THandler>(IAsyncTopicHandler <TTopic> handler) where TTopic : class
 {
     topicDispatcher.Register(handler);
     return(this);
 }