Exemple #1
0
        public void ShouldDelegateTraceMessageToLegacyLogger()
        {
            var legacyLogger = new Mock <ILogger>();
            var logger       = new LegacyLoggerAdapter(legacyLogger.Object);

            logger.Trace("message: {0}", "hello world");
            legacyLogger.Verify(x => x.Trace("message: hello world"));
        }
Exemple #2
0
        public void ShouldAllowNullLegacyLogger()
        {
            var logger = new LegacyLoggerAdapter(null);

            // should not throw any error
            logger.Error(null, "1");
            logger.Warn(null, "2");
            logger.Info(null, "3");
            logger.Debug("4");
            logger.Trace("5");
        }
Exemple #3
0
        public void ShouldDelegateTraceToLegacyLogger()
        {
            var legacyLogger = new Mock <ILogger>();
            var logger       = new LegacyLoggerAdapter(legacyLogger.Object);

            var message = "a message {0}";
            var error   = new Exception("an exception");

            logger.Trace(message, error);

            legacyLogger.Verify(x => x.Trace("a message System.Exception: an exception"));
        }