コード例 #1
0
        public void format_a_simple_exception()
        {
            var exception = new NotImplementedException();

            var sut    = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().Be("    System.NotImplementedException: The method or operation is not implemented.\r\n");
        }
コード例 #2
0
        public void format_a_simple_exception()
        {
            var exception = new NotImplementedException();

            var sut    = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().StartWith("    System.NotImplementedException");
        }
コード例 #3
0
        public void info_without_exception()
        {
            var sut = new BaseLoggerWrapper(GetType());

            sut.Info("Heloo");

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Info);
            sut.Entries[0].Exception.Should().BeNull();
        }
コード例 #4
0
        public void debug_with_exception()
        {
            var sut = new BaseLoggerWrapper(GetType());

            sut.Debug("Heloo", new ExternalException());

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Debug);
            sut.Entries[0].Exception.Should().BeOfType <ExternalException>();
        }
コード例 #5
0
        public void debug_formatted()
        {
            var sut = new BaseLoggerWrapper(GetType());

            sut.Debug("Heloo {0}", "World");

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo World");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Debug);
            sut.Entries[0].Exception.Should().BeNull();
        }
コード例 #6
0
        public void debug_with_exception()
        {

            var sut = new BaseLoggerWrapper(GetType());
            sut.Debug("Heloo", new ExternalException());

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Debug);
            sut.Entries[0].Exception.Should().BeOfType<ExternalException>();
        }
コード例 #7
0
        public void debug_formatted()
        {

            var sut = new BaseLoggerWrapper(GetType());
            sut.Debug("Heloo {0}", "World");

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo World");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Debug);
            sut.Entries[0].Exception.Should().BeNull();
        }
コード例 #8
0
        public void trace_without_exception()
        {

            var sut = new BaseLoggerWrapper(GetType());
            sut.Trace("Heloo");

            sut.Entries.Count.Should().Be(1);
            sut.Entries[0].Message.Should().Be("Heloo");
            sut.Entries[0].LogLevel.Should().Be(LogLevel.Trace);
            sut.Entries[0].Exception.Should().BeNull();
        }
コード例 #9
0
        public void ignore_null_properties_in_the_exception_output()
        {
            var exception = new ExceptionWithProperty2()
            {
                UserId = 10
            };

            var sut    = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().Be("    Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2: Exception of type 'Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2' was thrown.\r\n    [UserId='10']\r\n");
        }
コード例 #10
0
        public void include_properties_in_the_exception_output()
        {
            var exception = new ExceptionWithProperty2()
            {
                UserId = 10, FirstName = "Arne"
            };

            var sut    = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().StartWith("    Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2");
            actual.Should().EndWith("[UserId='10',FirstName='Arne']\r\n");
        }
コード例 #11
0
        public void ignore_null_properties_in_the_exception_output()
        {
            var exception = new ExceptionWithProperty2() { UserId = 10};

            var sut = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().Be("    Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2: Exception of type 'Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2' was thrown.\r\n    [UserId='10']\r\n");
        }
コード例 #12
0
        public void format_a_simple_exception()
        {
            var exception = new NotImplementedException();

            var sut = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().Be("    System.NotImplementedException: The method or operation is not implemented.\r\n");
        }
コード例 #13
0
        public void include_properties_in_the_exception_output()
        {
            var exception = new ExceptionWithProperty2() { UserId = 10, FirstName = "Arne"};

            var sut = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().Be("    Griffin.Tests.Logging.Loggers.ExceptionWithProperty2: Exception of type 'Griffin.Tests.Logging.Loggers.ExceptionWithProperty2' was thrown.\r\n    [UserId='10',FirstName='Arne']\r\n");
        }
コード例 #14
0
        public void include_properties_in_the_exception_output()
        {
            var exception = new ExceptionWithProperty2() { UserId = 10, FirstName = "Arne"};

            var sut = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().StartWith("    Griffin.Core.Tests.Logging.Loggers.ExceptionWithProperty2");
            actual.Should().EndWith("[UserId='10',FirstName='Arne']\r\n");
        }
コード例 #15
0
        public void format_a_simple_exception()
        {
            var exception = new NotImplementedException();

            var sut = new BaseLoggerWrapper(GetType());
            var actual = sut.FormatException(exception);

            actual.Should().StartWith("    System.NotImplementedException");
        }