コード例 #1
0
        public void GoBack_ThrowsException_NoPageInBackStack()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

            var e = Assert.Throws<InvalidOperationException>(() => navigationStack.GoBack());

            Assert.Equal("You cannot navigate backwards as the back stack is empty.", e.Message);
        }
コード例 #2
0
        public void CanGoBack_IsFalseIfOnePageNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

            navigationStack.NavigateTo(new PageInfo("Page 1", null));

            Assert.Equal(false, navigationStack.CanGoBack);
        }
コード例 #3
0
        public void CanGoBack_IsTrueIfTwoPagesNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

            navigationStack.NavigateTo(new PageInfo("Page 1", null));
            navigationStack.NavigateTo(new PageInfo("Page 2", null));

            Assert.Equal(true, navigationStack.CanGoBack);
        }
コード例 #4
0
        public void PropertyChanged_CanGoBack_IsNotCalledWhenFirstPageNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

            int changedCount = 0;
            navigationStack.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "CanGoBack") changedCount++; };

            navigationStack.NavigateTo(new PageInfo("Page 1", null));

            Assert.Equal(0, changedCount);
        }
コード例 #5
0
        public void CanGoBack_IsFalseIfNoPagesNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

            Assert.Equal(false, navigationStack.CanGoBack);
        }