Ejemplo n.º 1
0
        public void ShouldInitMethodUpdateSelectedTabIndex()
        {
            //arrange
            viewModel = new ContactViewModel(DataManager);

            //act
            int selectedIndex = 1;

            viewModel.Init(selectedIndex);

            //asert
            Assert.AreEqual(viewModel.SelectedTabIndex, selectedIndex);
        }
Ejemplo n.º 2
0
        public void ShouldBackFromDetailsCommandTakeYouBackToSelectedTabActive()
        {
            //arrange
            viewModel = new ContactViewModel(DataManager);

            //act
            viewModel.NavigationService.SetRootPage(nameof(DashboardPage), new DashboardViewModel());
            viewModel.NavigationService.NavigateAsync(nameof(CustomTabbedPage), null, false);
            int selectedTab = 1;

            viewModel.Init(selectedTab);
            Task.Run(async() =>
            {
                await viewModel.ExecuteBackFromDetailsCommandAsync();
            }).GetAwaiter().GetResult();

            //assert
            int currentTabIndex = viewModel.NavigationService.GetCurrentSelectedTabIndexOverMasterDetailPageWithTabbedPage();

            Assert.AreEqual(selectedTab, currentTabIndex);
        }