public void Emit() { string message = "PlainMessageTemplate"; LogEventLevel logEventLevel = LogEventLevel.Warning; TraceLevel expectedTraceLevel = TraceLevel.Warning; LogEvent logEvent = LogEventHelper.GetLogEvent(message, logEventLevel); ITextFormatter formatter = new MessageTemplateTextFormatter("{Message}", null); InMemoryTraceWriter traceWriter = new InMemoryTraceWriter(TraceLevel.Verbose); TraceWriterSink sink = new TraceWriterSink(traceWriter, formatter); Assert.Equal(0, traceWriter.Events.Count); sink.Emit(logEvent); Assert.Equal(1, traceWriter.Events.Count); TraceEvent traceEvent = traceWriter.Events.First(); Assert.Equal(message, traceEvent.Message); Assert.Equal(expectedTraceLevel, traceEvent.Level); }
public void Emit_NullLogEvent() { InMemoryTraceWriter traceWriter = new InMemoryTraceWriter(TraceLevel.Verbose); ITextFormatter formatter = new RawFormatter(); TraceWriterSink sink = new TraceWriterSink(traceWriter, formatter); Assert.Equal(0, traceWriter.Events.Count); sink.Emit(null); Assert.Equal(0, traceWriter.Events.Count); }