public void Error_InvalidFormatStringInException_DoesNotThrow() { var sink = new FakeLoggingSink(); new DefaultLogger(sink).Error(new Exception("{abc"), "test"); Assert.That(sink.LastEntry.Message, Does.Contain("{abc")); }
public void Error_WhenCalled_LogLevelIsError() { var sink = new FakeLoggingSink(); DefaultLogger.LogLevel = LogLevel.Debug; new DefaultLogger(sink).Error("some message"); Assert.That(sink.LastEntry.Level, Is.EqualTo(LogLevel.Error)); }
public void Write_LogLevelGreaterThanConfigured_MessageWritten() { var sink = new FakeLoggingSink(); var logger = new DefaultLogger(sink); DefaultLogger.LogLevel = LogLevel.Info; logger.Write(LogLevel.Warning, "some message"); Assert.That(sink.LastEntry.Message, Is.EqualTo("some message")); }
public void Write_LogLevelLessThanConfigured_NoMessageWritten() { var sink = new FakeLoggingSink(); var logger = new DefaultLogger(sink); DefaultLogger.LogLevel = LogLevel.Warning; logger.Write(LogLevel.Info, "some message"); Assert.That(sink.LastEntry, Is.Null); }