Пример #1
0
 private static void HandleNavigationResult(INavigationResult navigationResult)
 {
     if (!navigationResult.Success)
     {
         Exception ex = new InvalidNavigationException();
         if (navigationResult.Exception != null)
         {
             ex = navigationResult.Exception;
         }
         SetMainPageFromException(ex);
     }
 }
Пример #2
0
        /// <summary>
        /// 捕获异常
        /// </summary>
        /// <param name="navigationResult"></param>
        private static void HandleNavigationResult(INavigationResult navigationResult)
        {
            if (!navigationResult.Success)
            {
                Exception ex = new InvalidNavigationException();

                if (navigationResult.Exception != null)
                {
                    ex = navigationResult.Exception;
                }
                //An unknown error occurred. You may need to specify whether to Use Modal Navigation or not
                SetMainPageFromException(ex);
            }
        }
        public void Incorrect_NavigationProperty_Over_A_Collection_Throws_Helpful_Exception()
        {
            // Arrange
            var queryParseResult = new QueryParseResult(new[] { "orders", "trackingInformation" });

            // Act
            InvalidNavigationException thrownException = null;

            try {
                var result = _sut.Build(typeof(Customer), queryParseResult);
            }
            catch (InvalidNavigationException e) {
                thrownException = e;
            }

            // Assert
            Assert.NotNull(thrownException);
            Assert.True(thrownException.Message.Contains("trackingInformation"));             // The exception explicitly names the offending queryParameter
        }