public void FormatterListenerDoesNotFireInstrumentationWhenTracingString() { FormattedDatabaseTraceListener listener = new FormattedDatabaseTraceListener(new SqlDatabase(connectionString), "WriteLog", "AddCategory", new TextFormatter("TEST{newline}TEST")); MockLoggingInstrumentationListener instrumentationListener = new MockLoggingInstrumentationListener(); ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder(); binder.Bind(listener.GetInstrumentationEventProvider(), instrumentationListener); TraceEventCache eventCache = new TraceEventCache(); listener.TraceData(eventCache, "", TraceEventType.Error, 0, "message"); Assert.AreEqual(0, instrumentationListener.calls); }
public void FormatterListenerFiresInstrumentation() { FormattedDatabaseTraceListener listener = new FormattedDatabaseTraceListener(new SqlDatabase(connectionString), "WriteLog", "AddCategory", new TextFormatter("TEST{newline}TEST")); MockLoggingInstrumentationListener instrumentationListener = new MockLoggingInstrumentationListener(); ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder(); binder.Bind(listener.GetInstrumentationEventProvider(), instrumentationListener); TraceEventCache eventCache = new TraceEventCache(); listener.TraceData(eventCache, "", TraceEventType.Error, 0, new LogEntry("message", "category", 0, 0, TraceEventType.Error, "title", null)); Assert.AreEqual(1, instrumentationListener.calls); }