public void DoNothingWithoutException() { var logger = new NullLogger(); var message = "testing {0{"; var exception = new Exception("testing"); var parameters = new object[] { "One", 2 }; logger.Trace(message); logger.Debug(message); logger.Info(message); logger.Warn(message); logger.Error(message); logger.Fatal(message); logger.Trace(message, exception); logger.Debug(message, exception); logger.Info(message, exception); logger.Warn(message, exception); logger.Error(message, exception); logger.Fatal(message, exception); logger.Trace(message, parameters); logger.Debug(message, parameters); logger.Info(message, parameters); logger.Warn(message, parameters); logger.Error(message, parameters); logger.Fatal(message, parameters); logger.Trace(message, exception, parameters); logger.Debug(message, exception, parameters); logger.Info(message, exception, parameters); logger.Warn(message, exception, parameters); logger.Error(message, exception, parameters); logger.Fatal(message, exception, parameters); }
public void SimpleLogTest() { var myLogger = new NullLogger(); myLogger.Debug("FooBar"); myLogger.Warning("FooBar"); myLogger.Error("FooBar"); myLogger.Error(new Exception(), "FooBar"); myLogger.Info("FooBar"); myLogger.Info("FooBar", "Bar"); Assert.AreEqual(myLogger.IsDebugEnabled, myLogger.IsDebugEnabled); // We don't care about the actual value. }
public void null_logger_does_nothing() { var obj = new object(); var ex = new Exception(); var msg = "Log Message"; var logger = new NullLogger(); logger.Log(new LogEvent()); logger.Debug(obj); logger.Debug(msg); logger.Debug(msg, ex); logger.Error(obj); logger.Error(msg); logger.Error(msg, ex); logger.Fatal(obj); logger.Fatal(msg); logger.Fatal(msg, ex); logger.Info(obj); logger.Info(msg); logger.Info(msg, ex); logger.Warn(obj); logger.Warn(msg); logger.Warn(msg, ex); logger.Trace(obj); logger.Trace(msg); logger.Trace(msg, ex); logger.Level.ShouldBe(LogLevel.Trace); }
public void Test() { NullLogger nullLogger = NullLogger.Instance; nullLogger.IsDebug.Should().BeFalse(); nullLogger.IsInfo.Should().BeFalse(); nullLogger.IsWarn.Should().BeFalse(); nullLogger.IsError.Should().BeFalse(); nullLogger.IsTrace.Should().BeFalse(); nullLogger.Debug(null); nullLogger.Info(null); nullLogger.Warn(null); nullLogger.Error(null); nullLogger.Trace(null); }
public void WhenCallingInfoShouldEnterInfoMethod() { NullLogger logger = new NullLogger(); logger.Info("Test String"); }