Ejemplo n.º 1
0
        public void CustomFormatter_Must_Be_Applied(string message, LogLevel logLevel)
        {
            Func <LogLevel, object, Exception, string> customFormatter
                = (level, state, ex) => level + "hello world" + state.ToString();

            Func <string, LogLevel, bool> filter = (categoryName, level) => true;

            var coreLogger = new FakeCoreLogger();

            var logger = new AWSLogger("TestCategory", coreLogger, filter, customFormatter);

            logger.Log(logLevel, 0, message, null, (state, ex) => state.ToString());

            string expectedMessage = customFormatter(logLevel, message, null);

            Assert.Equal(expectedMessage, coreLogger.ReceivedMessages.First());
        }