public async Task OneTimeSetup() { Xamarin.Forms.Mocks.MockForms.Init(); navController = new NavController(); await navController.InitAsync(new TestPage0()); await navController.PushAsync <TestViewModel1>(); await navController.PushModalAsync <TestViewModel2>(); await navController.PushModalAsync <TestViewModel3>(); }
public async Task OnAppearing_runs_after_PopModalAsync(bool isAnimated) { await navController.PushAsync <TestViewModel1>(); await navController.PushModalAsync <TestViewModel2>(); await navController.PopModalAsync(isAnimated); Assume.That(navController.TopViewModel is TestViewModel1); var vm = navController.TopViewModel as TestViewModel1; Assert.IsTrue(vm.OnAppearingRuns == 2); }
public async Task OnAppearing_doesnt_runs_after_PopAsync_if_modal(bool isAnimated) { navController = new NavController(); await navController.InitAsync(new TestPage1()); await navController.PushAsync <TestViewModel2>(); await navController.PushModalAsync <TestViewModel3>(); await navController.PopAsync(isAnimated); var vm = navController.MainStack.GetCurrentViewModel(); Assume.That(vm is TestViewModel1); Assert.AreEqual(1, (vm as TestViewModel1).OnAppearingRuns); }
public async Task OnAppearing_doesnt_run_after_CollapseMainStack_if_modal() { navController = new NavController(); await navController.InitAsync(new TestPage0()); await navController.PushAsync <TestViewModel1>(); await navController.PushModalAsync <TestViewModel2>(); await navController.CollapseMainStack(); Assume.That(navController.RootViewModel is TestViewModel1); var vm = navController.RootViewModel as TestViewModel1; Assert.AreEqual(1, vm.OnAppearingRuns); }
public async Task OnAppearing_doesnt_run_after_PopToRootAsync_if_modal(bool isAnimated) { navController = new NavController(); await navController.InitAsync(new TestPage1()); await navController.PushAsync <TestViewModel2>(); await navController.PushModalAsync <TestViewModel3>(); await navController.PopToRootAsync(isAnimated); Assume.That(navController.RootViewModel is TestViewModel1); var vm = navController.RootViewModel as TestViewModel1; Assert.AreEqual(1, vm.OnAppearingRuns); }