示例#1
0
        public void LoggerBase_LoglevelIsError_ShouldInvokeOnlyError()
        {
            var l = new MyCounterLogger(LogLevel.Error);

            var logger = new LoggerWrapper(l);

            logger.Error(null);

            Assert.AreEqual(1, l.LogMessageInvokeCount);
        }
示例#2
0
        public void LoggerBase_LoglevelIsInfo_ShouldNotInvokeDebug()
        {
            var l = new MyCounterLogger(LogLevel.Info);

            var logger = new LoggerWrapper(l);

            logger.Debug(null);

            Assert.AreEqual(0, l.LogMessageInvokeCount);
        }
示例#3
0
        public void LoggerBase_LoglevelIsWarn_ShouldNotInvokeDebugOrInfo()
        {
            var l = new MyCounterLogger(LogLevel.Warning);

            var logger = new LoggerWrapper(l);

            logger.Debug(null);
            logger.Information(null);

            Assert.AreEqual(0, l.LogMessageInvokeCount);
        }
示例#4
0
        public void LoggerBase_LoglevelIsWarn_ShouldInvokeOnlyErrorAndWarnAndInfo()
        {
            var l = new MyCounterLogger(LogLevel.Warning);

            var logger = new LoggerWrapper(l);

            logger.Warning(null);
            logger.Error(null);

            Assert.AreEqual(2, l.LogMessageInvokeCount);
        }
示例#5
0
        public void LoggerBase_LoglevelIsDebug_ShouldInvokeErrorOrWarnOrInfoOrDebug()
        {
            var l = new MyCounterLogger(LogLevel.Debug);

            var logger = new LoggerWrapper(l);

            logger.Debug(null);
            logger.Information(null);
            logger.Warning(null);
            logger.Error(null);

            Assert.AreEqual(4, l.LogMessageInvokeCount);
        }
示例#6
0
        public void LoggerBase_LoglevelIsOff_ShouldNotInvokeAnyLogMessage()
        {
            var l = new MyCounterLogger(LogLevel.Off);

            var logger = new LoggerWrapper(l);

            logger.Debug(null);
            logger.Information(null);
            logger.Warning(null);
            logger.Error(null);

            Assert.AreEqual(0, l.LogMessageInvokeCount);
        }