Beispiel #1
0
        public void InfoDoesNotLogIfLogLevelInfoIsDisabled()
        {
            //given
            var target = new DefaultLogger(LogLevel.WARN, writeLineAction);

            // when
            target.Info("Info message");

            // then
            Assert.That(logOutputLines, Is.Empty);
        }
Beispiel #2
0
        public void InfoLogsAppropriateMessage()
        {
            //given
            var target = new DefaultLogger(LogLevel.DEBUG, writeLineAction);

            // when
            target.Info("Info message");

            // then
            Assert.That(logOutputLines.Count, Is.EqualTo(1));
            Assert.That(Regex.IsMatch(logOutputLines[0], $"^{LoggerDateTimePattern} INFO  \\[.+?\\] Info message$"), Is.True);
        }