public async Task ShouldNotExecutePipelineHandlersIfPipelineIsDisabledAsync() { var handler = new EventHandler(); var pipelineHandler = new EventPipelineHandler(); var container = new Container(x => { x.Add <IEventHandler <Event> >().Instance(handler); x.Add <IEventPipelineHandler <Event> >().Instance(pipelineHandler); }); var mediator = new Mediator(container.GetService); await Task.WhenAll(mediator.Publish(new Event())); handler.Executed.ShouldBeTrue(); pipelineHandler.Executed.ShouldBeFalse(); }
public async Task ShouldExecuteEventPipelineHandlers() { var handler = new EventHandler(); var pipelineHandler = new EventPipelineHandler(); var container = new Container(x => { x.Add <IEventHandler <Event> >().Instance(handler); x.Add <IEventPipelineHandler <Event> >().Instance(pipelineHandler); }); var mediator = new Mediator(container.GetService, new Configuration { EventPipelineEnabled = true }); await Task.WhenAll(mediator.Publish(new Event())); handler.Executed.ShouldBeTrue(); pipelineHandler.Executed.ShouldBeTrue(); }