Esempio n. 1
0
        public async Task OneTimeSetup()
        {
            Xamarin.Forms.Mocks.MockForms.Init();
            navController = new NavController();
            await navController.InitAsync(new TestPage0());

            await navController.PushAsync <TestViewModel1>();
        }
        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);
        }
        public async Task OnAppearing_runs_after_PopToRootAsync(bool isAnimated)
        {
            navController = new NavController();
            await navController.InitAsync(new TestPage1());

            await navController.PushAsync <TestViewModel2>();

            await navController.PushAsync <TestViewModel3>();

            await navController.PopToRootAsync(isAnimated);

            Assume.That(navController.RootViewModel is TestViewModel1);
            var vm = navController.RootViewModel as TestViewModel1;

            Assert.IsTrue(vm.OnAppearingRuns == 2);
        }
        public async Task SetNamingConventions_subNameSpace()
        {
            NavController.SetNamingConventions("Vms", "Pages");
            navController = new NavController();
            await navController.InitAsync(new Pages.TestVmsPage());

            Assert.IsInstanceOf <Vms.TestVmsViewModel>(navController.RootViewModel);

            await navController.PushAsync <Vms.TestVmsViewModel>();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(2, navController.MainStack.Count);
                Assert.IsInstanceOf <Pages.TestVmsPage>(navController.TopPage);
            });
        }
        public async Task SetNamingConventions_suffix()
        {
            NavController.SetNamingConventions(viewModelSuffix: "Vm", viewSuffix: "Pg");
            navController = new NavController();
            await navController.InitAsync(new TestPg0());

            Assert.IsInstanceOf <TestVm0>(navController.RootViewModel);

            await navController.PushAsync <TestVm0>();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(2, navController.MainStack.Count);
                Assert.IsInstanceOf <TestPg0>(navController.TopPage);
            });
        }
 public async Task Setup()
 {
     navController = new NavController();
     await navController.InitAsync(new TestPage0());
 }
Esempio n. 9
0
 public async Task SetupOnce()
 {
     Xamarin.Forms.Mocks.MockForms.Init();
     navController = new NavController();
     await navController.InitAsync(new TestPage0());
 }
        public async Task InitAsync_Page_IsInitialized_True()
        {
            await navController.InitAsync(new TestPage0());

            Assert.IsTrue(navController.IsInitialized);
        }