Exemplo n.º 1
0
        public void Logging_ExtensionTest_CriticalE()
        {
            var logger = new TestLogger();

            logger.LogCritical(33, new InvalidCastException(), "message {0} {1}.", "a", "b");

            logger.Last.EventId.Should().Be(33);
            logger.Last.Exception.Should().BeOfType<InvalidCastException>();
            logger.Last.LogLevel.Should().Be(LogLevel.Critical);
            logger.Last.Message.ToString().Should().Be("message a b.");
        }
Exemplo n.º 2
0
        public void Logging_ExtensionTest_CriticalC()
        {
            var logger = new TestLogger();

            logger.LogCritical(11, "message {0} {1}.", "a", "b");

            logger.Last.EventId.Should().Be(11);
            logger.Last.Exception.Should().BeNull();
            logger.Last.LogLevel.Should().Be(LogLevel.Critical);
            logger.Last.Message.ToString().Should().Be("message a b.");
        }
Exemplo n.º 3
0
        public void Logging_ExtensionTest_CriticalA()
        {
            var logger = new TestLogger();

            logger.LogCritical("some message.");

            logger.Last.EventId.Should().Be(0);
            logger.Last.Exception.Should().BeNull();
            logger.Last.LogLevel.Should().Be(LogLevel.Critical);
            logger.Last.Message.ToString().Should().Be("some message.");
        }
Exemplo n.º 4
0
 public TestLoggerFactory(TestLogger useLogger)
 {
     this.useLogger = useLogger;
 }
Exemplo n.º 5
0
        public void Logging_ExtensionTest_DebugB()
        {
            var logger = new TestLogger();

            logger.LogDebug("message {0} {1}.", "a", "b");

            logger.Last.EventId.Should().Be(0);
            logger.Last.Exception.Should().BeNull();
            logger.Last.LogLevel.Should().Be(LogLevel.Debug);
            logger.Last.Message.ToString().Should().Be("message a b.");
        }
Exemplo n.º 6
0
        public void Logging_ExtensionTest_WarnD()
        {
            var logger = new TestLogger();

            logger.LogWarn(new InvalidCastException(), "message {0} {1}.", "a", "b");

            logger.Last.EventId.Should().Be(0);
            logger.Last.Exception.Should().BeOfType<InvalidCastException>();
            logger.Last.LogLevel.Should().Be(LogLevel.Warning);
            logger.Last.Message.ToString().Should().Be("message a b.");
        }
Exemplo n.º 7
0
        public void Logging_ExtensionTest_InfoA()
        {
            var logger = new TestLogger();

            logger.LogInfo("some message.");

            logger.Last.EventId.Should().Be(0);
            logger.Last.Exception.Should().BeNull();
            logger.Last.LogLevel.Should().Be(LogLevel.Information);
            logger.Last.Message.ToString().Should().Be("some message.");
        }