public void Navigate_ToContentPage_ThenGoBack() { var navigationService = new PageNavigationServiceMock(_container); var rootPage = new Xamarin.Forms.Page(); ((IPageAware)navigationService).Page = rootPage; navigationService.Navigate("ContentPage"); Assert.True(rootPage.Navigation.ModalStack.Count == 1); Assert.IsType(typeof(ContentPageMock), rootPage.Navigation.ModalStack[0]); navigationService.GoBack(); Assert.True(rootPage.Navigation.ModalStack.Count == 0); }
public void NavigateAsync_ToContentPage_ThenGoBack() { var navigationService = new PageNavigationServiceMock(_container); var rootPage = new NavigationPage(new PageMock()); ((IPageAware)navigationService).Page = rootPage; Assert.IsType(typeof(PageMock), rootPage.CurrentPage); navigationService.Navigate("ContentPage", useModalNavigation: false); Assert.True(rootPage.Navigation.NavigationStack.Count == 2); Assert.IsType(typeof(ContentPageMock), rootPage.CurrentPage); navigationService.GoBack(useModalNavigation: false); Assert.True(rootPage.Navigation.NavigationStack.Count == 1); Assert.IsType(typeof(PageMock), rootPage.CurrentPage); }
public async void NavigateAsync_ToContentPage_ThenGoBack() { var pageMock = new ContentPageMock(); var navigationService = new PageNavigationServiceMock(_container); ((IPageAware)navigationService).Page = pageMock; var rootPage = new NavigationPage(pageMock); Assert.IsType(typeof(ContentPageMock), rootPage.CurrentPage); await navigationService.Navigate("TabbedPage"); Assert.True(rootPage.Navigation.NavigationStack.Count == 2); Assert.IsType(typeof(TabbedPageMock), rootPage.CurrentPage); await navigationService.GoBack(); Assert.True(rootPage.Navigation.NavigationStack.Count == 1); Assert.IsType(typeof(ContentPageMock), rootPage.CurrentPage); }