Exemple #1
0
        public void error_does_not_log_if_logger_level_is_lower()
        {
            const string msg    = "This is the message";
            var          logger = new InMemoryLogger(LogLevel.Fatal);

            logger.Logs.Count.ShouldBe(0);

            logger.Error(msg);

            logger.Logs.Count.ShouldBe(0);
        }
Exemple #2
0
        public void error_logs_string_to_buffer()
        {
            const string msg    = "This is the message";
            var          logger = new InMemoryLogger();

            logger.Logs.Count.ShouldBe(0);

            logger.Error(msg);

            var entry = logger.Logs[0];

            entry.ShouldNotBeNull();
            entry.Exception.ShouldBeNull();
            entry.Level.ShouldBe(LogLevel.Error);
            entry.Message.Equals(msg).ShouldBeTrue();
        }
Exemple #3
0
        public void error_logs_object_to_buffer()
        {
            ValueType obj    = true;
            var       logger = new InMemoryLogger();

            logger.Logs.Count.ShouldBe(0);

            logger.Error(obj);

            var entry = logger.Logs[0];

            entry.ShouldNotBeNull();
            entry.Exception.ShouldBeNull();
            entry.Level.ShouldBe(LogLevel.Error);
            entry.Message.Equals("True").ShouldBeTrue();
        }