Esempio n. 1
0
        public void ShouldPreserveTheStackTrace()
        {
            // Arrange - This test does not care about the internal logging, so disable it to remove the noise.
            _log.Disable();

            // Act
            InvalidOperationException interceptedException =
                Assert.Throws <InvalidOperationException>(() => _proxy.SynchronousVoidExceptionMethod());

            // Assert

            // Get the exception without being intercepted, this is used to compare against the intercepted exception.
            InvalidOperationException noneInterceptedException =
                Assert.Throws <InvalidOperationException>(() => _target.SynchronousVoidExceptionMethod());

            CompareStackTrace(noneInterceptedException, interceptedException);
        }
Esempio n. 2
0
        public async Task ShouldPreserveTheStackTrace()
        {
            // Arrange - This test does not care about the internal logging, so disable it to remove the noise.
            _log.Disable();

            // Act
            InvalidOperationException interceptedException =
                await Assert.ThrowsAsync <InvalidOperationException>(_proxy.AsynchronousResultExceptionMethod)
                .ConfigureAwait(false);

            // Assert

            // Get the exception without being intercepted, this is used to compare against the intercepted exception.
            InvalidOperationException noneInterceptedException =
                await Assert.ThrowsAsync <InvalidOperationException>(_target.AsynchronousResultExceptionMethod)
                .ConfigureAwait(false);

            CompareStackTrace(noneInterceptedException, interceptedException);
        }