Exemplo n.º 1
0
        public void GetGoBackCommand_ReturnsNewICommand()
        {
            MockNavigationManager navigationManager = new MockNavigationManager();

            ICommand command = navigationManager.GetGoBackCommand();

            Assert.IsNotNull(command);
        }
Exemplo n.º 2
0
        public void GetGoBackCommand_CanExecute_IsTrueIfCanGoBack()
        {
            MockNavigationManager navigationManager = new MockNavigationManager()
            {
                CanGoBack = true
            };

            ICommand command = navigationManager.GetGoBackCommand();

            Assert.AreEqual(true, command.CanExecute(null));
        }
Exemplo n.º 3
0
        public void GoBackCommand_Execute_DoesNothingIfCannotGoBack()
        {
            MockNavigationManager navigationManager = new MockNavigationManager()
            {
                CanGoBack = false
            };

            ICommand command = navigationManager.GetGoBackCommand();
            command.Execute(null);

            CollectionAssert.AreEqual(new string[] { }, (ICollection)navigationManager.MethodCallLog);
        }
Exemplo n.º 4
0
        public void GoBackCommand_Execute_CallsGoBackIfCanGoBack()
        {
            MockNavigationManager navigationManager = new MockNavigationManager()
            {
                CanGoBack = true
            };

            ICommand command = navigationManager.GetGoBackCommand();
            command.Execute(null);

            CollectionAssert.AreEqual(new string[] { "GoBack()" }, (ICollection)navigationManager.MethodCallLog);
        }
Exemplo n.º 5
0
        public void GetGoBackCommand_CanExecuteChanged_IsCalledWhenCanGoBackChanged()
        {
            MockNavigationManager navigationManager = new MockNavigationManager();

            ICommand command = navigationManager.GetGoBackCommand();

            int canExecuteChangedCount = 0;
            command.CanExecuteChanged += delegate(object sender, EventArgs e) { canExecuteChangedCount++; };

            navigationManager.RaiseCanGoBackChanged();

            Assert.AreEqual(1, canExecuteChangedCount);
        }