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

            logger.Warn(null, "message: {0}", "hello world");
            legacyLogger.Verify(x => x.Info("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 ShouldDelegateWarnToLegacyLogger()
        {
            var legacyLogger = new Mock <ILogger>();
            var logger       = new LegacyLoggerAdapter(legacyLogger.Object);

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

            logger.Warn(error, message);

            legacyLogger.Verify(x => x.Info(message, error));
        }