public void Navigate_To_Last()
        {
            var navigationSource = new NavigationSource();
            var commands         = new NavigationSourceCommands(navigationSource);

            MyNavViewModelA.Reset();
            MyNavViewModelB.Reset();
            MyNavViewModelC.Reset();

            commands.NavigateCommand.Execute(typeof(MyNavViewModelA));
            commands.NavigateCommand.Execute(typeof(MyNavViewModelB));
            commands.NavigateCommand.Execute(typeof(MyNavViewModelC));
            commands.MoveToPreviousCommand.Execute(null);
            commands.MoveToPreviousCommand.Execute(null);

            MyNavViewModelA.Reset();
            MyNavViewModelB.Reset();
            MyNavViewModelC.Reset();

            Assert.AreEqual(false, commands.MoveToFirstCommand.CanExecute(null));
            Assert.AreEqual(false, commands.MoveToPreviousCommand.CanExecute(null));
            Assert.AreEqual(true, commands.MoveToNextCommand.CanExecute(null));
            Assert.AreEqual(true, commands.MoveToLastCommand.CanExecute(null));
            commands.MoveToLastCommand.Execute(null);
            Assert.AreEqual(true, MyNavViewModelA.IsOnNavigatingFromInvoked);
            Assert.AreEqual(true, MyNavViewModelC.IsOnNavigatedToInvoked);
            Assert.AreEqual(true, commands.MoveToFirstCommand.CanExecute(null));
            Assert.AreEqual(true, commands.MoveToPreviousCommand.CanExecute(null));
            Assert.AreEqual(false, commands.MoveToNextCommand.CanExecute(null));
            Assert.AreEqual(false, commands.MoveToLastCommand.CanExecute(null));
        }
        public void Navigate_Sets_The_Content_Of_The_Content_Control()
        {
            MyNavViewModelA.Reset();

            var contentControl   = new ContentControl();
            var navigationSource = new ContentControlNavigationSource("1", contentControl);

            Assert.AreEqual("1", navigationSource.SourceName);

            Assert.AreEqual(0, navigationSource.Sources.Count);
            Assert.AreEqual(-1, navigationSource.CurrentIndex);

            navigationSource.Navigate(typeof(MyNavViewModelA), "p1");

            Assert.AreEqual(typeof(MyNavViewModelA), navigationSource.Current.GetType());
            Assert.IsNotNull(contentControl.Content);
            Assert.AreEqual(typeof(MyNavViewModelA), contentControl.Content.GetType());
            Assert.AreEqual(1, navigationSource.Sources.Count);
            Assert.AreEqual(0, navigationSource.CurrentIndex);
        }
        public void Commands_With_Views_To_Last()
        {
            var navigationSourceContainer = new NavigationSourceContainer();
            var n1 = new NavigationSource();
            var n2 = new NavigationSource();

            navigationSourceContainer.Register(n1);
            navigationSourceContainer.Register(n2);
            var commands = new NavigationSourceContainerCommands(navigationSourceContainer);

            MyNavViewA.Reset();
            MyNavViewB.Reset();
            MyNavViewC.Reset();
            MyNavViewModelA.Reset();
            MyNavViewModelB.Reset();
            MyNavViewModelC.Reset();

            Assert.AreEqual(0, n1.Sources.Count);
            Assert.AreEqual(0, n2.Sources.Count);
            Assert.AreEqual(-1, n1.CurrentIndex);
            Assert.AreEqual(-1, n2.CurrentIndex);

            commands.NavigateCommand.Execute(typeof(MyNavViewA)); // navigate
            commands.NavigateCommand.Execute(typeof(MyNavViewB));
            commands.NavigateCommand.Execute(typeof(MyNavViewC));
            commands.MoveToPreviousCommand.Execute(null); // previous
            commands.MoveToPreviousCommand.Execute(null); // previous // A

            MyNavViewA.Reset();
            MyNavViewB.Reset();
            MyNavViewC.Reset();
            MyNavViewModelA.Reset();
            MyNavViewModelB.Reset();
            MyNavViewModelC.Reset();

            commands.MoveToLastCommand.Execute(null); // next
            Assert.AreEqual(true, MyNavViewC.IsCanActivateInvoked);
            Assert.AreEqual(typeof(MyNavViewC), n1.Current.GetType());
            Assert.AreEqual(typeof(MyNavViewC), n2.Current.GetType());
        }