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);
        }
        public void CanGoBack_IsFalseIfOnePageNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

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

            Assert.Equal(false, navigationStack.CanGoBack);
        }
        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);
        }
        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);
        }
        public void CanGoBack_IsFalseIfNoPagesNavigated()
        {
            NavigationStackWithHome navigationStack = new NavigationStackWithHome();

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