예제 #1
0
        public void PushAsync_fires_InitializeAsync(bool isAnimated)
        {
            navController.DiPushAsync(new DiTestViewModel1(), null, isAnimated);
            Assume.That(navController.TopViewModel is DiTestViewModel1);
            var vm = navController.TopViewModel as DiTestViewModel1;

            Assert.IsTrue(vm.IsInitialized);
        }
        public async Task RemovePageFor_works_with_Di_pages()
        {
            navController = new NavController();
            await navController.DiInitAsync(new DiTestViewModel0());

            await navController.DiPushAsync(new DiTestViewModel1());

            await navController.DiPushAsync(new DiTestViewModel2());

            await navController.DiPushAsync(new DiTestViewModel3());

            Assume.That(navController.MainStack.Count == 4);
            Assume.That(navController.MainStack[1] is DiTestPage1);

            navController.RemovePageFor <DiTestViewModel1>();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(3, navController.MainStack.Count);
                Assert.IsNotInstanceOf <DiTestPage1>(navController.MainStack[1]);
            });
        }
        public async Task SetNamingConventions_subNameSpace_and_suffix_withDi()
        {
            NavController.SetNamingConventions("Vms", "Pages", "Vm", "Pg");
            navController = new NavController();
            await navController.DiInitAsync(new Vms.DiTestVmsVm());

            Assert.IsInstanceOf <Pages.DiTestVmsPg>(navController.RootPage);

            await navController.DiPushAsync(new Vms.DiTestVmsVm());

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

            Assert.IsInstanceOf <DiTestPg0>(navController.RootPage);

            await navController.DiPushAsync(new DiTestVm0());

            Assert.Multiple(() =>
            {
                Assert.AreEqual(2, navController.MainStack.Count);
                Assert.IsInstanceOf <DiTestPg0>(navController.TopPage);
            });
        }
 public void NotInitializedException_PushAsync_Di()
 {
     Assert.ThrowsAsync <NotInitializedException>(async() => { await navController.DiPushAsync(new TestViewModel0()); });
 }