Exemple #1
0
        public void SourceElementsNotInATreeWhenNavigatingWillThrow()
        {
            var button = new Button();

            var resolver  = new Mock <IRouteResolver>();
            var factory   = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);

            Assert.Throws <ImpossibleNavigationRequestException>(navigator.ResetHistory);
        }
 public void CanCreateNavigatorForASourceElementWhenNavigatorAlreadySet()
 {
     var oldNavigator = new Mock<INavigator>();
     var button = new Button();
     NavigationProperties.SetNavigator(button, oldNavigator.Object);
     
     var resolver = new Mock<IRouteResolver>();
     var factory = new NavigatorFactory(resolver.Object);
     var navigator = factory.GetOwningNavigator(button);
     Assert.AreEqual(navigator, oldNavigator.Object);
 }
Exemple #3
0
        public void CanCreateNavigatorForASourceElementWhenNavigatorAlreadySet()
        {
            var oldNavigator = new Mock <INavigator>();
            var button       = new Button();

            NavigationProperties.SetNavigator(button, oldNavigator.Object);

            var resolver  = new Mock <IRouteResolver>();
            var factory   = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);

            Assert.AreEqual(navigator, oldNavigator.Object);
        }
        public void CanCreateNavigatorForASourceElementWhenInATree()
        {
            var frame = new Frame();
            var button = new Button();
            frame.Content = button;

            var window = new TestWindow(frame);
            window.Show();
            window.ProcessEvents();

            var resolver = new Mock<IRouteResolver>();
            var factory = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);
            navigator.ResetHistory();

            window.Close();
        }
Exemple #5
0
        public void CanCreateNavigatorForASourceElementWhenInATree()
        {
            var frame  = new Frame();
            var button = new Button();

            frame.Content = button;

            var window = new TestWindow(frame);

            window.Show();
            window.ProcessEvents();

            var resolver  = new Mock <IRouteResolver>();
            var factory   = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);

            navigator.ResetHistory();

            window.Close();
        }
        public void SourceElementsNotInATreeWhenNavigatingWillThrow()
        {
            var button = new Button();

            var resolver = new Mock<IRouteResolver>();
            var factory = new NavigatorFactory(resolver.Object);
            var navigator = factory.GetOwningNavigator(button);

            Assert.Throws<ImpossibleNavigationRequestException>(navigator.ResetHistory);
        }