示例#1
0
 public void AddExceptionWithLogEventNull_ShouldThrow_ArgumentNullException()
 {
     // Arrange
     // Act
     // Assert
     Assert.Throws <ArgumentNullException>(() => ExceptionExtensions.Exception <StandardLoglevel>(null, new InvalidOperationException()));
 }
示例#2
0
        public void AddExceptionNull_Should_NotAddDetails()
        {
            // Arrange
            var logEvent = new LogEvent <StandardLoglevel>(_ => { }, StandardLoglevel.Warning);

            // Act
            ExceptionExtensions.Exception(logEvent, null).Should().BeSameAs(logEvent);

            // Assert
            logEvent.Details.OfType <ExceptionDetail>().Should().BeEmpty();
        }
示例#3
0
        public void AddException_Should_AddDetails()
        {
            // Arrange
            var exception = new InvalidOperationException();
            var logEvent  = new LogEvent <StandardLoglevel>(_ => { }, StandardLoglevel.Warning);

            // Act
            ExceptionExtensions.Exception(logEvent, exception).Should().BeSameAs(logEvent);

            // Assert
            logEvent.Details.OfType <ExceptionDetail>().Count().Should().Be(1);
        }