/// <summary>
 /// Gets a <see cref="CountryInfo"/> for the passed <see cref="RegionInfo"/>.
 /// </summary>
 /// <remarks>
 /// Never returns null.
 /// </remarks>
 /// <param name="regionInfo">The <see cref="RegionInfo"/> to get the <see cref="CountryInfo"/> for.</param>
 /// <returns>The <see cref="CountryInfo"/> corresponding to <paramref name="regionInfo"/>.</returns>
 public static CountryInfo GetCountry(this RegionInfo regionInfo)
 {
     return(CountryInfo.GetCountry(regionInfo.GetCountryCode()));
 }
Exemple #2
0
        public void CountryInfo_should_return_France_given_Fr()
        {
            Country enu = CountryInfo.GetCountry("Fr");

            enu.Should().Be(Country.France);
        }
        /// <summary>
        /// Gets a <see cref="CountryInfo"/> for the passed <see cref="CultureInfo"/>.
        /// </summary>
        /// <param name="cultureInfo">The <see cref="CultureInfo"/> to get the <see cref="CountryInfo"/> for.</param>
        /// <returns>The <see cref="CountryInfo"/> corresponding to <paramref name="cultureInfo"/> or null when there is no region associated with <paramref name="cultureInfo"/>, i.e. when <paramref name="cultureInfo"/> is a neutral or the invariant culture.</returns>
        public static CountryInfo GetCountry(this CultureInfo cultureInfo)
        {
            CountryCode?countryCode = cultureInfo.GetCountryCode();

            return(countryCode == null ? null : CountryInfo.GetCountry(countryCode.Value));
        }
Exemple #4
0
        public void CountryInfo_should_return_Zimbabwe_given_263()
        {
            Country enu = CountryInfo.GetCountry("263");

            enu.Should().Be(Country.Zimbabwe);
        }