Ejemplo n.º 1
0
        public void LoggingAwarning_WhenAwarningArrivesAndLoggerIsConfiguredToLogThem(bool logMessages, bool logErrors)
        {
            var sut = new Logger(true, false, false, logMessages, true, logErrors, new Dictionary <string, string>()
            {
                { "logFileFolder", DEFAULT_LOG_PATH }
            });
            var entry = Entry.Director.ConfigureToBuildWarning(SAMPLE_LOG_TEXT).Build();

            sut.LogMessage(entry);

            var validator = new LoggerFileValidator();

            validator.EnsureLineCountIs(1);
            validator.EnsureThatPoppedLineIs("warning", SAMPLE_LOG_TEXT);
        }
Ejemplo n.º 2
0
        public void LoggingMessageWarningAndError_WhenTheyArriveAndLoggerIsConfiguredToLogThem()
        {
            var sut = new Logger(true, false, false, true, true, true, new Dictionary <string, string>()
            {
                { "logFileFolder", DEFAULT_LOG_PATH }
            });
            var entry = Entry.Director.ConfigureToBuildFullLog(SAMPLE_LOG_TEXT).Build();

            sut.LogMessage(entry);

            var validator = new LoggerFileValidator();

            validator.EnsureLineCountIs(3);
            validator.EnsureThatPoppedLineIs("message", SAMPLE_LOG_TEXT);
            validator.EnsureThatPoppedLineIs("warning", SAMPLE_LOG_TEXT);
            validator.EnsureThatPoppedLineIs("error", SAMPLE_LOG_TEXT);
        }
Ejemplo n.º 3
0
        public void LoggingMessageAndError_WhenTheyArriveAndLoggerIsConfiguredToLogThem(bool logWarnings)
        {
            var sut = new Logger(true, false, false, true, logWarnings, true, new Dictionary <string, string>()
            {
                { "logFileFolder", DEFAULT_LOG_PATH }
            });
            var entry = new Entry.Builder()
                        .WithText(SAMPLE_LOG_TEXT)
                        .AsMessage()
                        .AsError()
                        .Build();

            sut.LogMessage(entry);

            var validator = new LoggerFileValidator();

            validator.EnsureLineCountIs(2);
            validator.EnsureThatPoppedLineIs("message", SAMPLE_LOG_TEXT);
            validator.EnsureThatPoppedLineIs("error", SAMPLE_LOG_TEXT);
        }