public async Task MiddleRoutesAreRemovedWithoutPoppingStack() { TestShell testShell = new TestShell( CreateShellSection <NavigationMonitoringTab>(shellContentRoute: "rootpage") ); testShell.RegisterPage("firstPage"); testShell.RegisterPage("secondPage"); testShell.RegisterPage("thirdPage"); testShell.RegisterPage("fourthPage"); testShell.RegisterPage("fifthPage"); var tab = (NavigationMonitoringTab)testShell.CurrentItem.CurrentItem; await testShell.GoToAsync("firstPage/secondPage/thirdPage/fourthPage/fifthPage"); tab.NavigationsFired.Clear(); Assert.That(testShell.CurrentState.Location.ToString(), Is.EqualTo($"//rootpage/firstPage/secondPage/thirdPage/fourthPage/fifthPage")); await testShell.GoToAsync($"//rootpage/thirdPage/fifthPage"); Assert.That(testShell.CurrentState.Location.ToString(), Is.EqualTo($"//rootpage/thirdPage/fifthPage")); Assert.AreEqual("OnRemovePage", tab.NavigationsFired[0]); Assert.AreEqual("OnRemovePage", tab.NavigationsFired[1]); Assert.AreEqual("OnRemovePage", tab.NavigationsFired[2]); Assert.AreEqual(3, tab.NavigationsFired.Count); }
public async Task PoppingSetsCorrectNavigationSource() { var shell = new TestShell(CreateShellItem(shellContentRoute: "item1")); shell.RegisterPage("page1"); shell.RegisterPage("page2"); await shell.GoToAsync("page1"); await shell.GoToAsync("page2"); await shell.Navigation.PopAsync(); shell.TestNavigatingArgs(ShellNavigationSource.Pop, "//item1/page1/page2", $".."); shell.TestNavigatedArgs(ShellNavigationSource.Pop, "//item1/page1/page2", $"//item1/page1"); }
public async Task PushingSetsCorrectNavigationSource() { var shell = new TestShell(CreateShellItem(shellItemRoute: "item1")); shell.RegisterPage(nameof(PushingSetsCorrectNavigationSource)); await shell.GoToAsync(nameof(PushingSetsCorrectNavigationSource)); shell.TestNavigatingArgs(ShellNavigationSource.Push, "//item1", $"{nameof(PushingSetsCorrectNavigationSource)}"); shell.TestNavigatedArgs(ShellNavigationSource.Push, "//item1", $"//item1/{nameof(PushingSetsCorrectNavigationSource)}"); }
public async Task SwappingOutVisiblePageDoesntRevealPreviousPage() { TestShell testShell = new TestShell( CreateShellSection <NavigationMonitoringTab>(shellContentRoute: "rootpage") ); testShell.RegisterPage("firstPage"); testShell.RegisterPage("pageToSwapIn"); var tab = (NavigationMonitoringTab)testShell.CurrentItem.CurrentItem; await testShell.GoToAsync("firstPage"); tab.NavigationsFired.Clear(); await testShell.GoToAsync($"../pageToSwapIn"); Assert.That(testShell.CurrentState.Location.ToString(), Is.EqualTo($"//rootpage/pageToSwapIn")); Assert.AreEqual("OnPushAsync", tab.NavigationsFired[0]); Assert.AreEqual("OnRemovePage", tab.NavigationsFired[1]); Assert.AreEqual(2, tab.NavigationsFired.Count); }