private async void RefreshCinemas()
        {
            try
            {
                cinemasListView.IsRefreshing = true;
                var position = await GeoLocation.GetCurrentLocation();

                var cinemas = await Service.GetCinemas(position.Latitude, position.Longitude, (int)Slider.Value);

                CinemaList = new ObservableCollection <Cinema>(cinemas.Where(c => c.Name != null));
                cinemasListView.ItemsSource = CinemaList;
            }
            catch (GeolocationException E)
            {
                await DisplayAlert("Error", "Please enable the location service.", "Exit");

                AppControls.CloseApp();
            }
            catch (TaskCanceledException E)
            {
                await DisplayAlert("Oops..!!", "Unable to find your location. Please try again.", "Ok");
            }
            catch (Exception E)
            {
                await DisplayAlert("Error", $"{E} - {E.Message}", "Exit");

                AppControls.CloseApp();
            }
            finally
            {
                cinemasListView.IsRefreshing = false;
            }
        }
Пример #2
0
        public void GetCinemasTest_return_collection_of_cinema()
        {
            //given
            var loadMoviesService = new LoadDataService();
            var sut = new CinemaService(loadMoviesService);

            //when
            var result = sut.GetCinemas();

            //then
            Assert.IsNotNull(result);
        }
Пример #3
0
        public void GetCinemasTest_return_collection_of_cinema()
        {
            //given
            var movies = new List <Movie> {
            };

            _moqLoadDataSvc.Setup(m => m.GetMovies(It.IsAny <string>())).Returns(movies);
            var sut = new CinemaService(_moqLoadDataSvc.Object);

            //when
            var result = sut.GetCinemas();

            //then
            Assert.IsInstanceOfType(result, typeof(IEnumerable <Movie>));
        }