Example #1
0
        public void fatal_logs_object_to_buffer()
        {
            ValueType obj    = true;
            var       logger = new InMemoryLogger();

            logger.Logs.Count.ShouldBe(0);

            logger.Fatal(obj);

            var entry = logger.Logs[0];

            entry.ShouldNotBeNull();
            entry.Exception.ShouldBeNull();
            entry.Level.ShouldBe(LogLevel.Fatal);
            entry.Message.Equals("True").ShouldBeTrue();
        }
Example #2
0
        public void fatal_logs_string_to_buffer()
        {
            const string msg    = "This is the message";
            var          logger = new InMemoryLogger();

            logger.Logs.Count.ShouldBe(0);

            logger.Fatal(msg);

            var entry = logger.Logs[0];

            entry.ShouldNotBeNull();
            entry.Exception.ShouldBeNull();
            entry.Level.ShouldBe(LogLevel.Fatal);
            entry.Message.Equals(msg).ShouldBeTrue();
        }
Example #3
0
        public void LoggedMessagesAreStoredAndAccessible()
        {
            const string debug = "Debug Message";
            const string trace = "Trace Message";
            const string fatal = "Fatal Message";

            var logger = new InMemoryLogger();

            logger.Logs.Count.ShouldBe(0);

            logger.Debug(debug);
            logger.Trace(trace);
            logger.Fatal(fatal);

            logger.Logs.Count.ShouldBe(3);

            var logs = logger.LogMessages;

            logs[0].ShouldBe(debug);
            logs[1].ShouldBe(trace);
            logs[2].ShouldBe(fatal);
        }