public void Can_send_event() { // arrange MassTransit massTransit = null; try { var container = new Container(); var handler = new TestEventHandler(); container.Register <IEventHandler <TestEvent> >(() => handler); var eventRegistry = new EventHandlerRegistry(container); var commandRegistry = new CommandHandlerRegistry(container); massTransit = new MassTransit(commandRegistry, eventRegistry, container); var eventBus = new EventBus(massTransit); // act eventBus.Publish(new TestEvent()); // assert Thread.Sleep(TimeSpan.FromSeconds(2)); Assert.That(handler.NumberOfTimesRan, Is.EqualTo(1)); } finally { if (massTransit != null) { massTransit.Dispose(); } } }
public void LogFormat(MassTransit.Logging.LogLevel level, string format, params object[] args) { _log.Log(GetNLogLevel(level), format, args); }
public void Log(MassTransit.Logging.LogLevel level, LogOutputProvider messageProvider) { _log.Log(GetNLogLevel(level), ToGenerator(messageProvider)); }
public void Log(MassTransit.Logging.LogLevel level, object obj, Exception exception) { _log.Log(GetNLogLevel(level), exception, obj?.ToString() ?? ""); }
public void Log(MassTransit.Logging.LogLevel level, object obj) { _log.Log(GetNLogLevel(level), obj); }
NLog.LogLevel GetNLogLevel(MassTransit.Logging.LogLevel level) { if (level == MassTransit.Logging.LogLevel.Fatal) return NLog.LogLevel.Fatal; if (level == MassTransit.Logging.LogLevel.Error) return NLog.LogLevel.Error; if (level == MassTransit.Logging.LogLevel.Warn) return NLog.LogLevel.Warn; if (level == MassTransit.Logging.LogLevel.Info) return NLog.LogLevel.Info; if (level == MassTransit.Logging.LogLevel.Debug) return NLog.LogLevel.Debug; if (level == MassTransit.Logging.LogLevel.All) return NLog.LogLevel.Trace; return NLog.LogLevel.Off; }
public void Log(MassTransit.Logging.LogLevel level, object obj, Exception exception) { _log.LogException(GetNLogLevel(level), obj == null ? "" : obj.ToString(), exception); }