diff --git a/README.md b/README.md index 8cd6134c2..2f5d91816 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ phoneNumber.Country.CallingCode; // 44 phoneNumber.Country.Continent; // Europe phoneNumber.Country.HasNationalDestinationCodes; // true phoneNumber.Country.HasTrunkPrefix; // true +phoneNumber.Country.InternationalCallPrefix; // 00 phoneNumber.Country.IsEuropeanUnionMember; // false phoneNumber.Country.IsNatoMember; // true phoneNumber.Country.Iso3166Code; // GB diff --git a/src/PhoneNumbers/CountryInfo.cs b/src/PhoneNumbers/CountryInfo.cs index ef31c47ab..2b07e4b45 100644 --- a/src/PhoneNumbers/CountryInfo.cs +++ b/src/PhoneNumbers/CountryInfo.cs @@ -15,11 +15,13 @@ public sealed partial class CountryInfo : IEquatable internal const string Africa = "Africa"; internal const string Asia = "Asia"; internal const string Europe = "Europe"; + internal const string ItuInternationalCallPrefix = "00"; internal const string NorthAmerica = "North America"; internal const string Oceania = "Oceania"; internal const string SouthAmerica = "South America"; #if !NET8_0_OR_GREATER private static readonly ReadOnlyCollection s_emptyIntArray = new(Array.Empty()); + private static readonly ReadOnlyDictionary s_emptyStringDictionary = new(new Dictionary(StringComparer.Ordinal)); #endif private static readonly ReadOnlyCollection s_formatters = new( @@ -65,6 +67,12 @@ internal CountryInfo() /// public bool HasTrunkPrefix => TrunkPrefix is not null; + /// + /// Gets the international call prefix. + /// + /// May also be referred to as international direct dialling or international subscriber dialling, defaults to the ITU recommended '00', see https://en.wikipedia.org/wiki/List_of_international_call_prefixes. + public string InternationalCallPrefix { get; init; } = ItuInternationalCallPrefix; + /// /// Gets a value indicating whether the country is a member of the European Union. /// @@ -106,6 +114,15 @@ internal CountryInfo() /// Gets the for the country. /// internal PhoneNumberFormatProvider FormatProvider { get; init; } = ComplexPhoneNumberFormatProvider.Default; + /// + /// Gets country specific international call prefixes. + /// + internal ReadOnlyDictionary InternationalCallPrefixes { get; init; } = + #if NET8_0_OR_GREATER + ReadOnlyDictionary.Empty; + #else + s_emptyStringDictionary; + #endif /// /// Gets the possible lengths of the national destination code. diff --git a/src/PhoneNumbers/CountryInfo_Africa.cs b/src/PhoneNumbers/CountryInfo_Africa.cs index f6c306515..fa63ac898 100644 --- a/src/PhoneNumbers/CountryInfo_Africa.cs +++ b/src/PhoneNumbers/CountryInfo_Africa.cs @@ -27,6 +27,12 @@ public partial class CountryInfo CallingCode = "254", Continent = Africa, FormatProvider = SimplePhoneNumberFormatProvider.Default, + InternationalCallPrefix = "000", + InternationalCallPrefixes = new Dictionary(StringComparer.Ordinal) + { + { "255", "007" }, // To call Tanzania from Kenya, subscribers dial 007 instead of +255 + { "256", "006" }, // To call Uganda from Kenya, subscribers dial 006 instead of +256 + }.AsReadOnly(), Iso3166Code = "KE", Name = "Kenya", NdcLengths = new ReadOnlyCollection([3, 2]), @@ -42,6 +48,7 @@ public partial class CountryInfo AllowsLocalGeographicDialling = true, CallingCode = "234", Continent = Africa, + InternationalCallPrefix = "009", Iso3166Code = "NG", Name = "Nigeria", NdcLengths = new ReadOnlyCollection([4, 3]), @@ -70,6 +77,12 @@ public partial class CountryInfo { CallingCode = "255", Continent = Africa, + InternationalCallPrefix = "000", + InternationalCallPrefixes = new Dictionary(StringComparer.Ordinal) + { + { "254", "005" }, // To call Kenya from Tanzania, subscribers dial 005 instead of +254 + { "256", "006" }, // To call Uganda from Tanzania, subscribers dial 006 instead of +256 + }.AsReadOnly(), Iso3166Code = "TZ", Name = "Tanzania", NdcLengths = new ReadOnlyCollection([5, 3, 2]), @@ -85,6 +98,12 @@ public partial class CountryInfo CallingCode = "256", Continent = Africa, FormatProvider = UGPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = "000", + InternationalCallPrefixes = new Dictionary(StringComparer.Ordinal) + { + { "254", "005" }, // To call Kenya from Uganda, subscribers dial 005 instead of +254 + { "255", "007" }, // To call Tanzania from Uganda, subscribers dial 007 instead of +255 + }.AsReadOnly(), Iso3166Code = "UG", Name = "Uganda", NdcLengths = new ReadOnlyCollection([6, 5, 4, 3, 1]), diff --git a/src/PhoneNumbers/CountryInfo_Asia.cs b/src/PhoneNumbers/CountryInfo_Asia.cs index 53f84bbce..61e85ed93 100644 --- a/src/PhoneNumbers/CountryInfo_Asia.cs +++ b/src/PhoneNumbers/CountryInfo_Asia.cs @@ -12,6 +12,7 @@ public partial class CountryInfo { CallingCode = "852", Continent = Asia, + InternationalCallPrefix = "001", Iso3166Code = "HK", Name = "Hong Kong", NsnLengths = new ReadOnlyCollection([8, 9, 11, 12]), @@ -36,6 +37,7 @@ public partial class CountryInfo { CallingCode = "65", Continent = Asia, + InternationalCallPrefix = "000", Iso3166Code = "SG", Name = "Singapore", NsnLengths = new ReadOnlyCollection([8, 10, 11]), diff --git a/src/PhoneNumbers/CountryInfo_Europe.cs b/src/PhoneNumbers/CountryInfo_Europe.cs index 3863e4e13..659182592 100644 --- a/src/PhoneNumbers/CountryInfo_Europe.cs +++ b/src/PhoneNumbers/CountryInfo_Europe.cs @@ -29,6 +29,7 @@ public partial class CountryInfo CallingCode = "375", Continent = Europe, FormatProvider = SimplePhoneNumberFormatProvider.Default, + InternationalCallPrefix = "8~10", Iso3166Code = "BY", Name = "Belarus", NdcLengths = new ReadOnlyCollection([4, 3, 2]), diff --git a/src/PhoneNumbers/CountryInfo_NorthAmerica.cs b/src/PhoneNumbers/CountryInfo_NorthAmerica.cs index f3a5f9531..96cbfa8ce 100644 --- a/src/PhoneNumbers/CountryInfo_NorthAmerica.cs +++ b/src/PhoneNumbers/CountryInfo_NorthAmerica.cs @@ -6,6 +6,7 @@ namespace PhoneNumbers; public partial class CountryInfo { internal const string NanpCallingCode = "1"; + internal const string NanpInternationalCallPrefix = "011"; private static readonly ReadOnlyCollection s_nanpNdcLengths = new([3]); private static readonly ReadOnlyCollection s_nanpNsnLengths = new([10]); @@ -18,6 +19,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "AI", Name = "Anguilla", NdcLengths = s_nanpNdcLengths, @@ -34,6 +36,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "AG", Name = "Antigua and Barbuda", NdcLengths = s_nanpNdcLengths, @@ -50,6 +53,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "BS", Name = "Bahamas", NdcLengths = s_nanpNdcLengths, @@ -66,6 +70,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "BB", Name = "Barbados", NdcLengths = s_nanpNdcLengths, @@ -82,6 +87,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "BM", Name = "Bermuda", NdcLengths = s_nanpNdcLengths, @@ -98,6 +104,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "VG", Name = "British Virgin Islands", NdcLengths = s_nanpNdcLengths, @@ -114,6 +121,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, IsNatoMember = true, Iso3166Code = "CA", IsOecdMember = true, @@ -132,6 +140,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "KY", Name = "Cayman Islands", NdcLengths = s_nanpNdcLengths, @@ -148,6 +157,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "DM", Name = "Dominica", NdcLengths = s_nanpNdcLengths, @@ -164,6 +174,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "GD", Name = "Grenada", NdcLengths = s_nanpNdcLengths, @@ -180,6 +191,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "JM", Name = "Jamaica", NdcLengths = s_nanpNdcLengths, @@ -196,6 +208,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "MS", Name = "Montserrat", NdcLengths = s_nanpNdcLengths, @@ -212,6 +225,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "MP", Name = "Northern Mariana Island", NdcLengths = s_nanpNdcLengths, @@ -228,6 +242,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "PR", Name = "Puerto Rico", NdcLengths = s_nanpNdcLengths, @@ -244,6 +259,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "KN", Name = "Saint Kitts and Nevis", NdcLengths = s_nanpNdcLengths, @@ -260,6 +276,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "LC", Name = "Saint Lucia", NdcLengths = s_nanpNdcLengths, @@ -276,6 +293,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "VC", Name = "Saint Vincent and the Grenadines", NdcLengths = s_nanpNdcLengths, @@ -292,6 +310,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "SX", Name = "Sint Maarten", NdcLengths = s_nanpNdcLengths, @@ -308,6 +327,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "TT", Name = "Trinidad and Tobago", NdcLengths = s_nanpNdcLengths, @@ -324,6 +344,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "TC", Name = "Turks and Caicos Islands", NdcLengths = s_nanpNdcLengths, @@ -340,6 +361,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, IsNatoMember = true, Iso3166Code = "US", IsOecdMember = true, @@ -357,6 +379,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "VI", Name = "United States Virgin Islands", NdcLengths = s_nanpNdcLengths, diff --git a/src/PhoneNumbers/CountryInfo_Oceania.cs b/src/PhoneNumbers/CountryInfo_Oceania.cs index 00218cc5e..58dbe7375 100644 --- a/src/PhoneNumbers/CountryInfo_Oceania.cs +++ b/src/PhoneNumbers/CountryInfo_Oceania.cs @@ -14,6 +14,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = Oceania, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "AS", Name = "American Samoa", NdcLengths = s_nanpNdcLengths, @@ -30,6 +31,7 @@ public partial class CountryInfo CallingCode = "61", Continent = Oceania, FormatProvider = AUPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = "0011", Iso3166Code = "AU", IsOecdMember = true, Name = "Australia", @@ -47,6 +49,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = Oceania, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "GU", Name = "Guam", NdcLengths = s_nanpNdcLengths, diff --git a/src/PhoneNumbers/CountryInfo_SouthAmerica.cs b/src/PhoneNumbers/CountryInfo_SouthAmerica.cs index a7675c89c..f3faf3092 100644 --- a/src/PhoneNumbers/CountryInfo_SouthAmerica.cs +++ b/src/PhoneNumbers/CountryInfo_SouthAmerica.cs @@ -14,6 +14,7 @@ public partial class CountryInfo CallingCode = "55", Continent = SouthAmerica, FormatProvider = BRPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = "0xx", Iso3166Code = "BR", Name = "Brazil", NdcLengths = new ReadOnlyCollection([3, 2]), diff --git a/src/PhoneNumbers/FrameworkExtensions/CollectionExtensions.cs b/src/PhoneNumbers/FrameworkExtensions/CollectionExtensions.cs new file mode 100644 index 000000000..f82fe7ee6 --- /dev/null +++ b/src/PhoneNumbers/FrameworkExtensions/CollectionExtensions.cs @@ -0,0 +1,12 @@ +#if !NET8_0_OR_GREATER +namespace System.Collections.Generic +{ + using System.Collections.ObjectModel; + + internal static class CollectionExtensions + { + internal static ReadOnlyDictionary AsReadOnly(this IDictionary dictionary) where TKey : notnull => + new ReadOnlyDictionary(dictionary); + } +} +#endif diff --git a/test/PhoneNumbers.Tests/CountryInfo_Africa_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_Africa_Tests.cs index 25300211f..9b41b6f9a 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_Africa_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_Africa_Tests.cs @@ -15,6 +15,8 @@ public void CountryInfo_Egypt() Assert.Equal("20", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("EG", countryInfo.Iso3166Code); @@ -37,6 +39,10 @@ public void CountryInfo_Kenya() Assert.Equal("254", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("000", countryInfo.InternationalCallPrefix); + Assert.Equal(2, countryInfo.InternationalCallPrefixes.Count); + Assert.Equal("006", countryInfo.InternationalCallPrefixes["256"]); // Uganda + Assert.Equal("007", countryInfo.InternationalCallPrefixes["255"]); // Tanzania Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("KE", countryInfo.Iso3166Code); @@ -59,6 +65,8 @@ public void CountryInfo_Nigeria() Assert.Equal("234", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("009", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("NG", countryInfo.Iso3166Code); @@ -81,6 +89,8 @@ public void CountryInfo_SouthAfrica() Assert.Equal("27", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("ZA", countryInfo.Iso3166Code); @@ -103,6 +113,10 @@ public void CountryInfo_Tanzania() Assert.Equal("255", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("000", countryInfo.InternationalCallPrefix); + Assert.Equal(2, countryInfo.InternationalCallPrefixes.Count); + Assert.Equal("005", countryInfo.InternationalCallPrefixes["254"]); // Kenya + Assert.Equal("006", countryInfo.InternationalCallPrefixes["256"]); // Uganda Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("TZ", countryInfo.Iso3166Code); @@ -125,6 +139,10 @@ public void CountryInfo_Uganda() Assert.Equal("256", countryInfo.CallingCode); Assert.Equal(CountryInfo.Africa, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("000", countryInfo.InternationalCallPrefix); + Assert.Equal(2, countryInfo.InternationalCallPrefixes.Count); + Assert.Equal("005", countryInfo.InternationalCallPrefixes["254"]); // Kenya + Assert.Equal("007", countryInfo.InternationalCallPrefixes["255"]); // Tanzania Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("UG", countryInfo.Iso3166Code); diff --git a/test/PhoneNumbers.Tests/CountryInfo_Asia_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_Asia_Tests.cs index 027f85143..f9ab1402f 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_Asia_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_Asia_Tests.cs @@ -15,6 +15,8 @@ public void CountryInfo_HongKong() Assert.Equal("852", countryInfo.CallingCode); Assert.Equal(CountryInfo.Asia, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("001", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("HK", countryInfo.Iso3166Code); @@ -37,6 +39,8 @@ public void CountryInfo_Macau() Assert.Equal("853", countryInfo.CallingCode); Assert.Equal(CountryInfo.Asia, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MO", countryInfo.Iso3166Code); @@ -59,6 +63,8 @@ public void CountryInfo_Singapore() Assert.Equal("65", countryInfo.CallingCode); Assert.Equal(CountryInfo.Asia, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("000", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("SG", countryInfo.Iso3166Code); @@ -81,6 +87,8 @@ public void CountryInfo_Turkey() Assert.Equal("90", countryInfo.CallingCode); Assert.Equal(CountryInfo.Asia, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("TR", countryInfo.Iso3166Code); diff --git a/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs index b88484c55..299515ce7 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs @@ -15,6 +15,8 @@ public void CountryInfo_Austria() Assert.Equal("43", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("AT", countryInfo.Iso3166Code); @@ -37,6 +39,8 @@ public void CountryInfo_Belarus() Assert.Equal("375", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("8~10", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BY", countryInfo.Iso3166Code); @@ -59,6 +63,8 @@ public void CountryInfo_Belgium() Assert.Equal("32", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("BE", countryInfo.Iso3166Code); @@ -81,6 +87,8 @@ public void CountryInfo_BosniaAndHerzegovina() Assert.Equal("387", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BA", countryInfo.Iso3166Code); @@ -103,6 +111,8 @@ public void CountryInfo_Bulgaria() Assert.Equal("359", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("BG", countryInfo.Iso3166Code); @@ -125,6 +135,8 @@ public void CountryInfo_Croatia() Assert.Equal("385", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("HR", countryInfo.Iso3166Code); @@ -147,6 +159,8 @@ public void CountryInfo_Cyprus() Assert.Equal("357", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("CY", countryInfo.Iso3166Code); @@ -169,6 +183,8 @@ public void CountryInfo_CzechRepublic() Assert.Equal("420", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("CZ", countryInfo.Iso3166Code); @@ -191,6 +207,8 @@ public void CountryInfo_Denmark() Assert.Equal("45", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("DK", countryInfo.Iso3166Code); @@ -213,6 +231,8 @@ public void CountryInfo_Estonia() Assert.Equal("372", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("EE", countryInfo.Iso3166Code); @@ -235,6 +255,8 @@ public void CountryInfo_Finland() Assert.Equal("358", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("FI", countryInfo.Iso3166Code); @@ -257,6 +279,8 @@ public void CountryInfo_France() Assert.Equal("33", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("FR", countryInfo.Iso3166Code); @@ -279,6 +303,8 @@ public void CountryInfo_Germany() Assert.Equal("49", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("DE", countryInfo.Iso3166Code); @@ -301,6 +327,8 @@ public void CountryInfo_Gibraltar() Assert.Equal("350", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("GI", countryInfo.Iso3166Code); @@ -323,6 +351,8 @@ public void CountryInfo_Greece() Assert.Equal("30", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("GR", countryInfo.Iso3166Code); @@ -345,6 +375,8 @@ public void CountryInfo_Guernsey() Assert.Equal("44", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("GG", countryInfo.Iso3166Code); @@ -367,6 +399,8 @@ public void CountryInfo_Hungary() Assert.Equal("36", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("HU", countryInfo.Iso3166Code); @@ -389,6 +423,8 @@ public void CountryInfo_Iceland() Assert.Equal("354", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("IS", countryInfo.Iso3166Code); @@ -411,6 +447,8 @@ public void CountryInfo_Ireland() Assert.Equal("353", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("IE", countryInfo.Iso3166Code); @@ -433,6 +471,8 @@ public void CountryInfo_IsleOfMan() Assert.Equal("44", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("IM", countryInfo.Iso3166Code); @@ -455,6 +495,8 @@ public void CountryInfo_Italy() Assert.Equal("39", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("IT", countryInfo.Iso3166Code); @@ -477,6 +519,8 @@ public void CountryInfo_Jersey() Assert.Equal("44", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("JE", countryInfo.Iso3166Code); @@ -499,6 +543,8 @@ public void CountryInfo_Kosovo() Assert.Equal("383", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("XK", countryInfo.Iso3166Code); @@ -521,6 +567,8 @@ public void CountryInfo_Latvia() Assert.Equal("371", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("LV", countryInfo.Iso3166Code); @@ -543,6 +591,8 @@ public void CountryInfo_Liechtenstein() Assert.Equal("423", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("LI", countryInfo.Iso3166Code); @@ -565,6 +615,8 @@ public void CountryInfo_Lithuania() Assert.Equal("370", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("LT", countryInfo.Iso3166Code); @@ -587,6 +639,8 @@ public void CountryInfo_Luxembourg() Assert.Equal("352", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("LU", countryInfo.Iso3166Code); @@ -609,6 +663,8 @@ public void CountryInfo_Malta() Assert.Equal("356", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MT", countryInfo.Iso3166Code); @@ -631,6 +687,8 @@ public void CountryInfo_Moldova() Assert.Equal("373", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MD", countryInfo.Iso3166Code); @@ -653,6 +711,8 @@ public void CountryInfo_Monaco() Assert.Equal("377", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MC", countryInfo.Iso3166Code); @@ -675,6 +735,8 @@ public void CountryInfo_Montenegro() Assert.Equal("382", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("ME", countryInfo.Iso3166Code); @@ -697,6 +759,8 @@ public void CountryInfo_Netherlands() Assert.Equal("31", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("NL", countryInfo.Iso3166Code); @@ -719,6 +783,8 @@ public void CountryInfo_NorthMacedonia() Assert.Equal("389", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("MK", countryInfo.Iso3166Code); @@ -741,6 +807,8 @@ public void CountryInfo_Norway() Assert.Equal("47", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("NO", countryInfo.Iso3166Code); @@ -763,6 +831,8 @@ public void CountryInfo_Poland() Assert.Equal("48", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("PL", countryInfo.Iso3166Code); @@ -785,6 +855,8 @@ public void CountryInfo_Portugal() Assert.Equal("351", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("PT", countryInfo.Iso3166Code); @@ -807,6 +879,8 @@ public void CountryInfo_Romania() Assert.Equal("40", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("RO", countryInfo.Iso3166Code); @@ -829,6 +903,8 @@ public void CountryInfo_SanMarino() Assert.Equal("378", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("SM", countryInfo.Iso3166Code); @@ -851,6 +927,8 @@ public void CountryInfo_Serbia() Assert.Equal("381", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("RS", countryInfo.Iso3166Code); @@ -873,6 +951,8 @@ public void CountryInfo_Slovakia() Assert.Equal("421", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("SK", countryInfo.Iso3166Code); @@ -895,6 +975,8 @@ public void CountryInfo_Slovenia() Assert.Equal("386", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("SL", countryInfo.Iso3166Code); @@ -917,6 +999,8 @@ public void CountryInfo_Spain() Assert.Equal("34", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("ES", countryInfo.Iso3166Code); @@ -939,6 +1023,8 @@ public void CountryInfo_Sweden() Assert.Equal("46", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.True(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("SE", countryInfo.Iso3166Code); @@ -961,6 +1047,8 @@ public void CountryInfo_Switzerland() Assert.Equal("41", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("CH", countryInfo.Iso3166Code); @@ -983,6 +1071,8 @@ public void CountryInfo_Ukraine() Assert.Equal("380", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("UA", countryInfo.Iso3166Code); @@ -1005,6 +1095,8 @@ public void CountryInfo_UnitedKingdom() Assert.Equal("44", countryInfo.CallingCode); Assert.Equal(CountryInfo.Europe, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("GB", countryInfo.Iso3166Code); diff --git a/test/PhoneNumbers.Tests/CountryInfo_NorthAmerica_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_NorthAmerica_Tests.cs index 3ab36a931..e21187a89 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_NorthAmerica_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_NorthAmerica_Tests.cs @@ -15,6 +15,8 @@ public void CountryInfo_Anguilla() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("AI", countryInfo.Iso3166Code); @@ -37,6 +39,8 @@ public void CountryInfo_AntiguaAndBarbuda() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("AG", countryInfo.Iso3166Code); @@ -59,6 +63,8 @@ public void CountryInfo_Bahamas() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BS", countryInfo.Iso3166Code); @@ -81,6 +87,8 @@ public void CountryInfo_Barbados() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BB", countryInfo.Iso3166Code); @@ -103,6 +111,8 @@ public void CountryInfo_Bermuda() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BM", countryInfo.Iso3166Code); @@ -125,6 +135,8 @@ public void CountryInfo_BritishVirginIslands() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("VG", countryInfo.Iso3166Code); @@ -147,6 +159,8 @@ public void CountryInfo_Canada() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("CA", countryInfo.Iso3166Code); @@ -169,6 +183,8 @@ public void CountryInfo_CaymanIslands() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("KY", countryInfo.Iso3166Code); @@ -191,6 +207,8 @@ public void CountryInfo_Dominica() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("DM", countryInfo.Iso3166Code); @@ -213,6 +231,8 @@ public void CountryInfo_Grenada() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("GD", countryInfo.Iso3166Code); @@ -235,6 +255,8 @@ public void CountryInfo_Jamaica() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("JM", countryInfo.Iso3166Code); @@ -257,6 +279,8 @@ public void CountryInfo_Montserrat() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MS", countryInfo.Iso3166Code); @@ -279,6 +303,8 @@ public void CountryInfo_NorthernMarianaIsland() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("MP", countryInfo.Iso3166Code); @@ -301,6 +327,8 @@ public void CountryInfo_PuertoRico() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("PR", countryInfo.Iso3166Code); @@ -323,6 +351,8 @@ public void CountryInfo_SaintKittsAndNevis() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("KN", countryInfo.Iso3166Code); @@ -345,6 +375,8 @@ public void CountryInfo_SaintLucia() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("LC", countryInfo.Iso3166Code); @@ -367,6 +399,8 @@ public void CountryInfo_SaintVincentAndTheGrenadines() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("VC", countryInfo.Iso3166Code); @@ -389,6 +423,8 @@ public void CountryInfo_SintMaarten() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("SX", countryInfo.Iso3166Code); @@ -411,6 +447,8 @@ public void CountryInfo_TrinidadAndTobago() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("TT", countryInfo.Iso3166Code); @@ -433,6 +471,8 @@ public void CountryInfo_TurksAndCaicosIslands() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("TC", countryInfo.Iso3166Code); @@ -455,6 +495,8 @@ public void CountryInfo_UnitedStates() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.True(countryInfo.IsNatoMember); Assert.Equal("US", countryInfo.Iso3166Code); @@ -477,6 +519,8 @@ public void CountryInfo_UnitedStatesVirginIslands() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.NorthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("VI", countryInfo.Iso3166Code); diff --git a/test/PhoneNumbers.Tests/CountryInfo_Oceania_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_Oceania_Tests.cs index 04f41e4b4..69d6dd3a8 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_Oceania_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_Oceania_Tests.cs @@ -16,6 +16,8 @@ public void CountryInfo_AmericanSamoa() Assert.Equal(CountryInfo.Oceania, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); Assert.False(countryInfo.IsEuropeanUnionMember); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsNatoMember); Assert.Equal("AS", countryInfo.Iso3166Code); Assert.False(countryInfo.IsOecdMember); @@ -37,6 +39,8 @@ public void CountryInfo_Australia() Assert.Equal("61", countryInfo.CallingCode); Assert.Equal(CountryInfo.Oceania, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("0011", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("AU", countryInfo.Iso3166Code); @@ -59,6 +63,8 @@ public void CountryInfo_Guam() Assert.Equal(CountryInfo.NanpCallingCode, countryInfo.CallingCode); Assert.Equal(CountryInfo.Oceania, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.NanpInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("GU", countryInfo.Iso3166Code); @@ -81,6 +87,8 @@ public void CountryInfo_PapuaNewGuinea() Assert.Equal("675", countryInfo.CallingCode); Assert.Equal(CountryInfo.Oceania, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("PG", countryInfo.Iso3166Code); diff --git a/test/PhoneNumbers.Tests/CountryInfo_SouthAmerica_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_SouthAmerica_Tests.cs index 3f5dec3e8..57061d8d5 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_SouthAmerica_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_SouthAmerica_Tests.cs @@ -15,6 +15,8 @@ public void CountryInfo_Brazil() Assert.Equal("55", countryInfo.CallingCode); Assert.Equal(CountryInfo.SouthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal("0xx", countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("BR", countryInfo.Iso3166Code); @@ -37,6 +39,8 @@ public void CountryInfo_Colombia() Assert.Equal("57", countryInfo.CallingCode); Assert.Equal(CountryInfo.SouthAmerica, countryInfo.Continent); Assert.IsType(countryInfo.FormatProvider); + Assert.Equal(CountryInfo.ItuInternationalCallPrefix, countryInfo.InternationalCallPrefix); + Assert.Empty(countryInfo.InternationalCallPrefixes); Assert.False(countryInfo.IsEuropeanUnionMember); Assert.False(countryInfo.IsNatoMember); Assert.Equal("CO", countryInfo.Iso3166Code);