public void Error_WithException_LogsEventWithSeverityOfError()
        {
            // Arrange
            var expectedSeverity = LoggingEventType.Error;
            var moduleUnderTest  = new TestAspNetExceptionLoggingModule();
            var context          = new HttpApplication();

            moduleUnderTest.Init(context);

            using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged))
            {
                // Act
                RaisErrorOnContext(context, new Exception());

                // Assert
                Assert.AreEqual(expectedSeverity, scope.LoggedEntries.First().Severity);
            }
        }
        public void Error_WithException_LogsException()
        {
            // Arrange
            var moduleUnderTest   = new TestAspNetExceptionLoggingModule();
            var context           = new HttpApplication();
            var expectedException = new Exception();

            moduleUnderTest.Init(context);

            using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged))
            {
                // Act
                RaisErrorOnContext(context, expectedException);
                var actualException = scope.LoggedEntries.First().Exception;

                // Assert
                Assert.AreEqual(expectedException, actualException);
            }
        }
        public void Error_WithHttpUnhandledExceptionWithInnerException_LogsInnerException()
        {
            // Arrange
            var moduleUnderTest   = new TestAspNetExceptionLoggingModule();
            var context           = new HttpApplication();
            var expectedException = new InvalidOperationException();
            var exceptionForError = new HttpUnhandledException("some message", expectedException);

            moduleUnderTest.Init(context);

            using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged))
            {
                // Act
                RaisErrorOnContext(context, exceptionForError);
                var actualException = scope.LoggedEntries.First().Exception;

                // Assert
                Assert.AreEqual(expectedException, actualException);
            }
        }