コード例 #1
0
        public void FrameworkExtensions_GetBaseException_Returns_The_Base_Exception()
        {
            var ex = new NullReferenceException();

            var witsmlEx = ex.GetBaseException <Exception>();

            Assert.IsNotNull(witsmlEx);

            witsmlEx = ex.GetBaseException <WitsmlException>();

            Assert.IsNull(witsmlEx);

            ex       = new NullReferenceException("null", new Exception("innerEx"));
            witsmlEx = ex.GetBaseException <WitsmlException>();

            Assert.IsNull(witsmlEx);

            ex       = new NullReferenceException("null", new WitsmlException(ErrorCodes.ApiVersionNotMatch));
            witsmlEx = ex.GetBaseException <WitsmlException>();

            Assert.IsNotNull(witsmlEx);
        }