public static void UseMessageHandlers(this IApplicationBuilder app, Action <MessageHandlersConfigurationBuilder> configure) { var builder = new MessageHandlersConfigurationBuilder(app.ApplicationServices); configure(builder); builder.Build(); }
public void Build_HandlerWasAdded_PublishedEventGetsHandledInSystem() { var builder = new MessageHandlersConfigurationBuilder(serviceProvider); builder.AddHandler <SampleMessage, SampleMessageHandler>(); builder.Build(); bus.Publish(new SampleMessage()); Assert.That(handler.Count, Is.EqualTo(1)); }
public void Build_DelegateWasAdded_PublishedEventGetsHandledInSystem() { int counter = 0; var builder = new MessageHandlersConfigurationBuilder(serviceProvider); builder.AddHandler <SampleMessage>(m => counter++); builder.Build(); bus.Publish(new SampleMessage()); Assert.That(counter, Is.EqualTo(1)); }