예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void WhenCallingFatalShouldEnterFatalMethod()
        {
            NullLogger logger = new NullLogger();

            logger.Fatal("Test String", new Exception());
        }
예제 #4
0
        public void WhenCallingFatalShouldEnterFatalMethod()
        {
            NullLogger logger = new NullLogger();

            logger.Fatal("Test String", new Exception());
        }