Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void ReturnNullEntry_WhenMessageWithoutTextIsSpecified()
        {
            var entry = new Entry.Builder().AsMessage().Build();

            Assert.IsType <NullEntry>(entry);
        }