public void Ensure_that_informational_message_are_filtered_for_warning_level_logger() { var sut = new LogProvider(); var mockLogger = new MockLogger(); sut.AddLogger(mockLogger); var logSource = new StubLogSource(); sut.AddLogSourceToLoggers(logSource); logSource.SayHelloTo("John"); Assert.Null(mockLogger.LastLoggedEvent); }
public void Test_text_writer_logger() { var lp = new LogProvider(); var stringWriter = new StringWriter(); var sut = new TextWriterLogger(LogLevel.Informational, stringWriter); lp.AddLogger(sut); var logSource = new StubLogSource(); lp.AddLogSourceToLoggers(logSource); logSource.SayHelloTo("John"); lp.Dispose(); Assert.True(stringWriter.GetStringBuilder().ToString().Contains("John")); }