Exemplo n.º 1
0
        public Iso3166Country(string alpha2Code, string name, Iso3166CountryCodeStatus status, string[] newCodes)
        {
            Alpha2Code      = alpha2Code;
            CountryName     = name;
            Status          = status;
            NewCountryCodes = newCodes;

            if (alpha2Code.Length != 2)
            {
                throw new ArgumentException("Country code must contain exactly two characters", "alpha2Code");
            }

            if (newCodes.Any(code => code.Length != 2))
            {
                throw new ArgumentException("All new codes must contain exactly two characters", "newCodes");
            }
        }
Exemplo n.º 2
0
 public void DoesNotThrow_IfCountryCodesAreTwoLetters([Values("PL", "GB")] String newCountryCode, [ValueSource("TestStatuses")] Iso3166CountryCodeStatus status)
 {
     Assert.DoesNotThrow(() => new Iso3166Country("PL", "Some name", status, new[] { newCountryCode }));
 }
Exemplo n.º 3
0
 public void Throws_IfAnyOfTheNewCountryCodesDifferentFromTwoLetters([Values("P", "PPP")] String countryCode, [ValueSource("TestStatuses")] Iso3166CountryCodeStatus status)
 {
     Assert.Throws <ArgumentException>(() => new Iso3166Country(countryCode, "Some name", status, new string[0]));
 }
Exemplo n.º 4
0
 public Iso3166Country(string alpha2Code, string name, Iso3166CountryCodeStatus status)
     : this(alpha2Code, name, status, new string[] { })
 {
 }