Esempio n. 1
0
        public void display_appropriate_location_text_on_landing_to_second_page()
        {
            TestNavigationService testNavigationService = new TestNavigationService();
            TestLocationService   testLocationService   = new TestLocationService();

            testLocationService.LocationEnabled = true;
            var locationPageViewModel = new LocationPageViewModel(testLocationService, testNavigationService);

            if (locationPageViewModel.OnClick.CanExecute(null))
            {
                locationPageViewModel.OnClick.Execute(null);
            }

            Assert.AreEqual("Location service is enabled on device.", locationPageViewModel.LocationText);

            testLocationService.LocationEnabled = false;
            locationPageViewModel = new LocationPageViewModel(testLocationService, testNavigationService);

            if (locationPageViewModel.OnClick.CanExecute(null))
            {
                locationPageViewModel.OnClick.Execute(null);
            }

            Assert.AreEqual("Location service is unable/turned off in the device.", locationPageViewModel.LocationText);
        }
Esempio n. 2
0
        public void navigate_to_previous_page_when_back_button_is_clicked()
        {
            TestNavigationService testNavigationService = new TestNavigationService();
            TestLocationService   testLocationService   = new TestLocationService();

            var locationPageViewModel = new LocationPageViewModel(testLocationService, testNavigationService);

            if (locationPageViewModel.OnClick.CanExecute(null))
            {
                locationPageViewModel.OnClick.Execute(null);
            }

            Assert.AreEqual(typeof(MainPageViewModel), testNavigationService.ViewModel);
        }
Esempio n. 3
0
        public void navigate_to_second_page_when_next_button_is_clicked()
        {
            TestNavigationService testNavigationService = new TestNavigationService();
            TestLocationService   testLocationService   = new TestLocationService();

            var mainPageViewModel = new MainPageViewModel();

            mainPageViewModel.LocationService   = testLocationService;
            mainPageViewModel.NavigationService = testNavigationService;

            if (mainPageViewModel.OnClick.CanExecute(null))
            {
                mainPageViewModel.OnClick.Execute(null);
            }

            Assert.AreEqual(typeof(LocationPageViewModel), testNavigationService.ViewModel.GetType());
        }
Esempio n. 4
0
        public void display_appropriate_display_message_on_landing_to_second_page()
        {
            TestNavigationService testNavigationService = new TestNavigationService();
            TestLocationService   testLocationService   = new TestLocationService();

            var mainPageViewModel = new MainPageViewModel();

            mainPageViewModel.LocationService   = testLocationService;
            mainPageViewModel.NavigationService = testNavigationService;
            mainPageViewModel.WelcomeText       = "Ashray";

            if (mainPageViewModel.OnClick.CanExecute(null))
            {
                mainPageViewModel.OnClick.Execute(null);
            }

            Assert.AreEqual("Welcome Ashray", ((LocationPageViewModel)testNavigationService.ViewModel).WelcomeText);
        }