From 782eb643ecad0e246059407cb323ec334ebedde1 Mon Sep 17 00:00:00 2001 From: Trevor Pilley Date: Tue, 5 Nov 2024 17:36:37 +0000 Subject: [PATCH] Add InternationalCallPrefix --- README.md | 1 + src/PhoneNumbers/CountryInfo.cs | 17 ++++ src/PhoneNumbers/CountryInfo_Africa.cs | 19 ++++ src/PhoneNumbers/CountryInfo_Asia.cs | 2 + src/PhoneNumbers/CountryInfo_Europe.cs | 1 + src/PhoneNumbers/CountryInfo_NorthAmerica.cs | 23 +++++ src/PhoneNumbers/CountryInfo_Oceania.cs | 3 + src/PhoneNumbers/CountryInfo_SouthAmerica.cs | 1 + .../CollectionExtensions.cs | 12 +++ .../CountryInfo_Africa_Tests.cs | 18 ++++ .../CountryInfo_Asia_Tests.cs | 8 ++ .../CountryInfo_Europe_Tests.cs | 90 +++++++++++++++++++ .../CountryInfo_NorthAmerica_Tests.cs | 44 +++++++++ .../CountryInfo_Oceania_Tests.cs | 8 ++ .../CountryInfo_SouthAmerica_Tests.cs | 4 + 15 files changed, 251 insertions(+) create mode 100644 src/PhoneNumbers/FrameworkExtensions/CollectionExtensions.cs diff --git a/README.md b/README.md index 97f31d37e..6efe0d7a4 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 bfe59c2ed..46979fca3 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. /// @@ -101,6 +109,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 fd5f80652..346b6ead4 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 fe223b3e0..1ca8bd2d3 100644 --- a/src/PhoneNumbers/CountryInfo_Europe.cs +++ b/src/PhoneNumbers/CountryInfo_Europe.cs @@ -28,6 +28,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 350295c57..82b6b4fe6 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", Name = "Canada", @@ -131,6 +139,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "KY", Name = "Cayman Islands", NdcLengths = s_nanpNdcLengths, @@ -147,6 +156,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "DM", Name = "Dominica", NdcLengths = s_nanpNdcLengths, @@ -163,6 +173,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "GD", Name = "Grenada", NdcLengths = s_nanpNdcLengths, @@ -179,6 +190,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "JM", Name = "Jamaica", NdcLengths = s_nanpNdcLengths, @@ -195,6 +207,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "MS", Name = "Montserrat", NdcLengths = s_nanpNdcLengths, @@ -211,6 +224,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "MP", Name = "Northern Mariana Island", NdcLengths = s_nanpNdcLengths, @@ -227,6 +241,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "PR", Name = "Puerto Rico", NdcLengths = s_nanpNdcLengths, @@ -243,6 +258,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "KN", Name = "Saint Kitts and Nevis", NdcLengths = s_nanpNdcLengths, @@ -259,6 +275,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "LC", Name = "Saint Lucia", NdcLengths = s_nanpNdcLengths, @@ -275,6 +292,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, @@ -291,6 +309,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "SX", Name = "Sint Maarten", NdcLengths = s_nanpNdcLengths, @@ -307,6 +326,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "TT", Name = "Trinidad and Tobago", NdcLengths = s_nanpNdcLengths, @@ -323,6 +343,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, Iso3166Code = "TC", Name = "Turks and Caicos Islands", NdcLengths = s_nanpNdcLengths, @@ -339,6 +360,7 @@ public partial class CountryInfo CallingCode = NanpCallingCode, Continent = NorthAmerica, FormatProvider = NanpPhoneNumberFormatProvider.Instance, + InternationalCallPrefix = NanpInternationalCallPrefix, IsNatoMember = true, Iso3166Code = "US", Name = "United States", @@ -355,6 +377,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 cda854c0b..8ead216f1 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", Name = "Australia", NdcLengths = new ReadOnlyCollection([3, 2, 1]), @@ -46,6 +48,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 1483327b8..6a2edb360 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 bfc6772b2..ab8d85383 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); @@ -36,6 +38,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); @@ -57,6 +63,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); @@ -78,6 +86,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); @@ -99,6 +109,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); @@ -120,6 +134,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 4c888fbe4..6b1aa9af8 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); @@ -36,6 +38,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); @@ -57,6 +61,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); @@ -78,6 +84,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 bf24ea272..b540f857c 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); @@ -36,6 +38,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); @@ -57,6 +61,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); @@ -78,6 +84,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); @@ -99,6 +107,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); @@ -120,6 +130,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); @@ -141,6 +153,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); @@ -162,6 +176,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); @@ -183,6 +199,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); @@ -204,6 +222,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); @@ -225,6 +245,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); @@ -246,6 +268,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); @@ -267,6 +291,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); @@ -288,6 +314,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); @@ -309,6 +337,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); @@ -330,6 +360,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); @@ -351,6 +383,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); @@ -372,6 +406,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); @@ -393,6 +429,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); @@ -414,6 +452,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); @@ -435,6 +475,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); @@ -456,6 +498,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); @@ -477,6 +521,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); @@ -498,6 +544,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); @@ -519,6 +567,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); @@ -540,6 +590,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); @@ -561,6 +613,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); @@ -582,6 +636,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); @@ -603,6 +659,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); @@ -624,6 +682,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); @@ -645,6 +705,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); @@ -666,6 +728,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); @@ -687,6 +751,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); @@ -708,6 +774,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); @@ -729,6 +797,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); @@ -750,6 +820,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); @@ -771,6 +843,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); @@ -792,6 +866,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); @@ -813,6 +889,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); @@ -834,6 +912,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); @@ -855,6 +935,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); @@ -876,6 +958,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); @@ -897,6 +981,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); @@ -918,6 +1004,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); @@ -939,6 +1027,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 aa8a026d2..ccf1e6504 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); @@ -36,6 +38,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); @@ -57,6 +61,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); @@ -78,6 +84,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); @@ -99,6 +107,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); @@ -120,6 +130,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); @@ -141,6 +153,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); @@ -162,6 +176,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); @@ -183,6 +199,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); @@ -204,6 +222,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); @@ -225,6 +245,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); @@ -246,6 +268,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); @@ -267,6 +291,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); @@ -288,6 +314,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); @@ -309,6 +337,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); @@ -330,6 +360,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); @@ -351,6 +383,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); @@ -372,6 +406,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); @@ -393,6 +429,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); @@ -414,6 +452,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); @@ -435,6 +475,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); @@ -456,6 +498,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 d7ec6e79d..04063e33d 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.Equal("American Samoa", countryInfo.Name); @@ -36,6 +38,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); @@ -57,6 +61,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); @@ -78,6 +84,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 1e4a11a84..cf300150f 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); @@ -36,6 +38,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);