public async void AllTestAsync() { List <string> filters = new List <string> () { Filters.Name }; List <Country> allCountries = await RestCountry.AllAsync(filters); List <Country> countries = await RestCountry.AllAsync(); foreach (Country con in allCountries) { if (con.Name == "Nepal") { _NepalResultFiltered(con); } } foreach (Country con in countries) { if (con.Name == "Nepal") { _NepalResultFull(con); } } }
public void AllTest() { List <string> filters = new List <string>() { Filters.Name }; List <Country> allCountriesFiltered = RestCountry.All(filters); List <Country> allCountries = RestCountry.All(); foreach (Country con in allCountries) { if (con.Name == "Nepal") { _NepalResultFull(con); } } foreach (Country con in allCountriesFiltered) { if (con.Name == "Nepal") { _NepalResultFiltered(con); } } }
public static Country ToCountry(this RestCountry restCountry) { return(new Country { Name = restCountry.Name, Capital = restCountry.capital }); }
public async void AsyncCodeTest() { List <Country> con = await RestCountry.CodeAsync("NP"); foreach (Country c in con) { _NepalResultFull(c); } }
public void CodeTest() { List <Country> con = RestCountry.Code("NP"); foreach (Country c in con) { _NepalResultFull(c); } }
/// <summary> /// Generates the sentence out of random <see cref="RestCountry"/> properties. /// </summary> /// <param name="country">The country.</param> /// <param name="propertyCount">The property count.</param> /// <returns>The generated sentence.</returns> private string GenerateSentence(RestCountry country, int propertyCount) { var propertyPairs = RestCountryPropertyInfoProvider.GetRandomProperties(country, 3); var sentencifiedPairs = propertyPairs.Select(pair => $"{pair.PropertyName} is {pair.Value}"); var joinedSentence = string.Join(", ", sentencifiedPairs.Take(propertyCount - 1)); joinedSentence += $" and {sentencifiedPairs.Last()}"; return(joinedSentence); }
public void NameTest() { List <Country> con = RestCountry.Name("ne"); foreach (Country c in con) { if (c.Name == "Nepal") { _NepalResultFull(c); } } }
public void AllTest() { List <string> filters = new List <string> () { Filters.Name }; List <Country> allCountriesFiltered = RestCountry.All(filters); List <Country> allCountries = RestCountry.All(); List <string> filterByAlphaCode = new List <string> () { Filters.Alpha2Code }; List <Country> alllCountriesAlphaCodeFilter = RestCountry.All(filterByAlphaCode); foreach (Country con in allCountries) { if (con.Name == "Nepal") { _NepalResultFull(con); } } foreach (Country con in allCountriesFiltered) { if (con.Name == "Nepal") { _NepalResultFiltered(con); } } foreach (Country con in alllCountriesAlphaCodeFilter) { if (con.Name == "Nepal") { Assert.Equal("NP", con.Alpha2Code); } } }
public List <Country> CountryTable() { List <Country> allCountries = RestCountry.All(); return(allCountries); }
public static IEnumerable <(string PropertyName, string Value)> GetRandomProperties(RestCountry country, int amount) { return(Properties .OrderBy(prop => Random.Next()) .Take(amount) .Select(prop => (prop.Name, prop.GetValue(country).ToString())) .ToArray()); }