public Command GetCommand(ReportLevel reportLevel, string dateTime, string message) { Command cmd = null; switch (reportLevel) { case ReportLevel.Info: cmd = new InfoCommand(dateTime, reportLevel, message); break; case ReportLevel.Warning: cmd = new WarningCommand(dateTime, reportLevel, message); break; case ReportLevel.Error: cmd = new ErrorCommand(dateTime, reportLevel, message); break; case ReportLevel.Critical: cmd = new CriticalCommand(dateTime, reportLevel, message); break; case ReportLevel.Fatal: cmd = new FatalCommand(dateTime, reportLevel, message); break; } return(cmd); }
public async Task Dispatch_Command_CriticalHandlerThrow_Should_NotCallNextHandlers() { HandlersData = ""; var cmd = new CriticalCommand(); var c = new InMemoryCommandBusConfigurationBuilder().AllowMultipleHandlersFor <CriticalCommand>(true).Build(); var bus = new InMemoryCommandBus(c); await bus.DispatchAsync(cmd); HandlersData.Should().Be("A"); }