Example #1
0
        protected override void OnAppearing()
        {
            listView.ItemTemplate = new DataTemplate(typeof(CompetitionsView));
            IDownloadCompetition download = new DownloadCompetition();

            _vm.DownloadData(download, listView, grid, LblNoInternet);

            listView.ItemSelected += async(s, e) =>
            {
                grid.IsVisible = true;
                CustomCompetition item = (CustomCompetition)e.SelectedItem;
                CompetitionPage   page = new CompetitionPage();
                page.Title = item.Caption;
                (Application.Current as App).CompetitionId = item.Id;
                //await Task.Delay(1000);
                await Navigation.PushAsync(page);
            };
        }
Example #2
0
        public void CompetionsViewIsUpdated()
        {
            CompetitionsViewModel competitonsView = new CompetitionsViewModel();

            DownloadCompetitions downresults = new DownloadCompetitions();
            ListView             lst         = new ListView();
            Grid  grd = new Grid();
            Label lbl = new Label();

            competitonsView.DownloadData(downresults, lst, grd, lbl);

            List <CustomCompetition> cstlst = (List <CustomCompetition>)lst.ItemsSource;

            Assert.AreEqual(cstlst[0].Id, downresults.results[0].Id);
            Assert.AreEqual(cstlst[0].Caption, downresults.results[0].Caption);
            Assert.AreEqual(cstlst[0].League, downresults.results[0].League);
            Assert.AreEqual(cstlst[0].CurrentMatchday, downresults.results[0].CurrentMatchday.ToString());
            Assert.AreEqual(cstlst[0].NumberOfMatchdays, downresults.results[0].NumberOfMatchdays.ToString());
            Assert.AreEqual(cstlst[0].NumerOfTeams, downresults.results[0].NumberOfTeams.ToString());
        }