Esempio n. 1
0
        public void IsEnabled_forwards_to_NLog_logger(LogLevel level, NLog.LogLevel expected)
        {
            var sut = CreateSystemUnderTest();

            sut.IsEnabled(level);

            mockLogger.Verify(p => p.IsEnabled(expected), Times.Once);
        }
Esempio n. 2
0
        public void Log_levels_are_correctly_converted(LogLevel level, NLog.LogLevel expected)
        {
            var sut = CreateSystemUnderTest();

            var message = fixture.Create<string>();

            IDictionary<string, object> dictionary = new Dictionary<string, object>
            {
                ["message"] = message
            };

            sut.Log(level, dictionary, exception: null);

            mockLogger.Verify(p => p.Log(It.Is<LogEventInfo>(lei => lei.Level == expected)), Times.Once);
        }
Esempio n. 3
0
        public void Log_levels_are_correctly_converted(LogLevel level, NLog.LogLevel expected)
        {
            var sut = CreateSystemUnderTest();

            var message = fixture.Create <string>();

            IDictionary <string, object> dictionary = new Dictionary <string, object>
            {
                ["message"] = message
            };

            sut.Log(level, dictionary, exception: null);

            mockLogger.Verify(p => p.Log(It.Is <LogEventInfo>(lei => lei.Level == expected)), Times.Once);
        }
        public void IsEnabled_forwards_to_Microsoft_Logger([Frozen] ILogger logger, NybusLoggerAdapter sut, LogLevel level)
        {
            sut.IsEnabled(level);

            Mock.Get(logger).Verify(p => p.IsEnabled(It.IsAny <MicrosoftLogLevel>()));
        }
        public void Log_doesnt_forward_to_Microsoft_Logger_if_message_is_not_specified([Frozen] ILogger logger, NybusLoggerAdapter sut, LogLevel level, Dictionary <string, object> data, Exception exception)
        {
            sut.Log(level, data, exception);

            Mock.Get(logger).Verify(p => p.Log(It.IsAny <MicrosoftLogLevel>(), It.IsAny <EventId>(), It.IsAny <IDictionary <string, object> >(), It.IsAny <Exception>(), It.IsAny <Func <IDictionary <string, object>, Exception, string> >()), Times.Never);
        }
        public void Log_forwards_to_Microsoft_Logger_if_message_is_specified([Frozen] ILogger logger, NybusLoggerAdapter sut, LogLevel level, Dictionary <string, object> data, Exception exception, string message)
        {
            data.Add("message", message);

            sut.Log(level, data, exception);

            Mock.Get(logger).Verify(p => p.Log(It.IsAny <MicrosoftLogLevel>(), It.IsAny <EventId>(), data, exception, It.IsAny <Func <IDictionary <string, object>, Exception, string> >()));
        }
 public void ToNybusLogLevel_converts_to_right_value(LogLevel logLevel, NybusLogLevel nybus)
 {
     Assert.That(logLevel.ToNybusLogLevel(), Is.EqualTo(nybus));
 }
 public void ToMicrosoftLogLevel_converts_to_right_value(NybusLogLevel nybus, LogLevel logLevel)
 {
     Assert.That(nybus.ToMicrosoftLogLevel(), Is.EqualTo(logLevel));
 }
Esempio n. 9
0
        public void IsEnabled_forwards_to_NLog_logger(LogLevel level, NLog.LogLevel expected)
        {
            var sut = CreateSystemUnderTest();

            sut.IsEnabled(level);

            mockLogger.Verify(p => p.IsEnabled(expected), Times.Once);
        }