예제 #1
0
        public void ExceptionGetInnerExceptionOrDefaultShouldReturnExceptionIfInnerExceptionIsNull()
        {
            var exceptionWithNoInnerException = new InvalidOperationException("invalidOperationException", innerException: null);

            var exception = exceptionWithNoInnerException.GetInnerExceptionOrDefault();

            Assert.AreSame(exceptionWithNoInnerException, exception);
        }
예제 #2
0
        public void ExceptionGetInnerExceptionOrDefaultReturnsInnerExceptionIfAvailable()
        {
            var innerException = new NotImplementedException("notImplementedException");
            var exceptionWithInnerException = new InvalidOperationException("invalidOperationException", innerException);

            var exception = exceptionWithInnerException.GetInnerExceptionOrDefault();

            Assert.AreSame(innerException, exception);
        }