public CountryInfoPageViewModel(Country selectedCountry)
        {
            Country = selectedCountry;
            GetPopulation();
            ItemsSource = new List<OthersListViewItem>
            {
                new OthersListViewItem{ Name = "Birth and Death"},
                new OthersListViewItem{ Name = "Health and Disease"},
                new OthersListViewItem{ Name = "Education"},
                new OthersListViewItem{ Name = "Economic Activity"},

            };
        }
        public CountryInfoPageViewModel(Country selectedCountry)
        {
            Country = selectedCountry;

            GetPopulation();
            GetLifeExpectancy();

            ItemsSource = new List<Item>
            {
                new Item{ Name = "Birth and Death"},
                new Item{ Name = "Health and Disease"},
                new Item{ Name = "Education"},
            };
        }
        public async Task<List<Country>> GetCountries()
        {
           return await Task.Run(() =>
            {
                List<Country> countries = new List<Country>();
                CountriesByRegion = new Dictionary<string, List<Country>>();
                var csv = DataProvider.GetResourceCsvFileData(@"WorldData.Data.world-stats-quandl.csv");
                for (var i = 1; i < csv.Rows.Count; i++)
                {
                    var country = new Country
                    {
                        Name = csv[i, "Country"],
                        AreaCode = csv[i, "Area Code"],
                        RegionName = csv[i, "Region"],
                        Level = csv[i, "Level"],
                        Units = (csv[i, "Units"]).ToInteger(),
                        AsOf = csv[i, "As Of"],
                        Chg1Y = csv[i, "1Y Chg"],
                        Year5 = csv[i, "5Y Ago"],
                        Year10 = csv[i, "10Y Ago"],
                        Year25 = csv[i, "25Y Ago"],
                        LifeExpectancy = csv[i, "Life Expectancy"],
                        HealthExpenditure = csv[i, "Health Expenditure"],
                        AdultLiteracyRate = csv[i, "Adult Literacy Rate"],
                         
                    };

                    countries.Add(country);
                    if(CountriesByRegion.ContainsKey(country.RegionName))
                        CountriesByRegion[country.RegionName].Add(country);
                    else
                    {
                        CountriesByRegion.Add(country.RegionName, new List<Country>{country});
                    }
                }

                return countries;
            });


        }
 public CountryDetailsPageViewModel(Country selectedCountry, string selectedItem)
 {
     country = selectedCountry;
     SelectedItem = selectedItem;
     GetData();
 }
Ejemplo n.º 5
0
        public void CanGetAllCountries()
        {
            //arrange
            ChartRepository chartRepo = new ChartRepository(mockContext.Object);
            Country Usa = new Country { CountryId = 1, Name = "USA" };
            Country Mexico = new Country { CountryId = 2, Name = "Mexico" };

            myCountries.Add(Usa);
            myCountries.Add(Mexico);
            //act
            ConnectMocksToDataSource();
            List<Country> Actual = chartRepo.GetAllCountries();
            //assert
            Assert.AreEqual(Actual.Count(), 2);
        }