Aspects.Logging.Tests.LoggingAspectBaseFunctionalityTests.WhenCallingMethodWithExceptionShouldHitDebugAndError C# (CSharp) Method

WhenCallingMethodWithExceptionShouldHitDebugAndError() private method

        public void WhenCallingMethodWithExceptionShouldHitDebugAndError()
        {
            // act
            try
            {
                ThrowsException();
            }
            catch (Exception e)
            {
                // we leave the base exception type here so we can catch any exception and later verify that it is the right type
                // assert
                e.Should()
                    .BeOfType<NotImplementedException>("because we only explicitly threw a NotImplementedException");
                _logger.DebugCallCount.Should().Be(2, "becase we should only hit the Entry and Exit methods");
                _logger.ErrorCallCount.Should().Be(1, "because we should hit the Exception method");
            }
        }