diff --git a/src/PhoneNumbers/CountryInfo_Europe.cs b/src/PhoneNumbers/CountryInfo_Europe.cs index 88e050348..42b54820a 100644 --- a/src/PhoneNumbers/CountryInfo_Europe.cs +++ b/src/PhoneNumbers/CountryInfo_Europe.cs @@ -5,6 +5,19 @@ namespace PhoneNumbers; public partial class CountryInfo { + /// + /// Gets the for Albania. + /// + public static CountryInfo Albania { get; } = new() + { + CallingCode = "355", + Continent = Europe, + Iso3166Code = "AL", + Name = "Albania", + NsnLengths = new ReadOnlyCollection(new[] { 8 }), + TrunkPrefix = "0", + }; + /// /// Gets the for Austria. /// diff --git a/src/PhoneNumbers/DataFiles/AL.txt b/src/PhoneNumbers/DataFiles/AL.txt new file mode 100644 index 000000000..5bf747233 --- /dev/null +++ b/src/PhoneNumbers/DataFiles/AL.txt @@ -0,0 +1,2 @@ +# References: +# - https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000020002PDFE.pdf diff --git a/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs b/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs index f027ba405..9956a236c 100644 --- a/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs +++ b/test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs @@ -4,6 +4,26 @@ namespace PhoneNumbers.Tests; public class CountryInfo_Europe_Tests { + [Fact] + public void CountryInfo_Albania() + { + Assert.Same(CountryInfo.Albania, CountryInfo.Albania); + + var countryInfo = CountryInfo.Albania; + + Assert.False(countryInfo.AllowsLocalGeographicDialling); + Assert.Equal("355", countryInfo.CallingCode); + Assert.Equal(CountryInfo.Europe, countryInfo.Continent); + Assert.IsType(countryInfo.FormatProvider); + Assert.False(countryInfo.IsEuropeanUnionMember); + Assert.Equal("AL", countryInfo.Iso3166Code); + Assert.Equal("Albania", countryInfo.Name); + Assert.Empty(countryInfo.NdcLengths); + Assert.Equal(new[] { 8 }, countryInfo.NsnLengths); + Assert.False(countryInfo.SharesCallingCode); + Assert.Equal("0", countryInfo.TrunkPrefix); + } + [Fact] public void CountryInfo_Austria() { diff --git a/test/PhoneNumbers.Tests/PhoneNumber_Parse_Europe_Tests.cs b/test/PhoneNumbers.Tests/PhoneNumber_Parse_Europe_Tests.cs index 57e555b68..687d4b343 100644 --- a/test/PhoneNumbers.Tests/PhoneNumber_Parse_Europe_Tests.cs +++ b/test/PhoneNumbers.Tests/PhoneNumber_Parse_Europe_Tests.cs @@ -2,6 +2,14 @@ namespace PhoneNumbers.Tests; public class PhoneNumber_Parse_Europe_Tests { + [Fact] + public void Parse_Value_For_Albania_CallingCode() + { + var phoneNumber = PhoneNumber.Parse("+35542259571"); + Assert.NotNull(phoneNumber); + Assert.Equal(CountryInfo.Albania, phoneNumber.Country); + } + [Fact] public void Parse_Value_For_Austria_CallingCode() { diff --git a/test/PhoneNumbers.Tests/PhoneNumber_ToString_Europe_Tests.cs b/test/PhoneNumbers.Tests/PhoneNumber_ToString_Europe_Tests.cs index b59cac563..478315dac 100644 --- a/test/PhoneNumbers.Tests/PhoneNumber_ToString_Europe_Tests.cs +++ b/test/PhoneNumbers.Tests/PhoneNumber_ToString_Europe_Tests.cs @@ -2,6 +2,13 @@ namespace PhoneNumbers.Tests; public class PhoneNumber_ToString_Europe_Tests { + [Theory] + [InlineData("+35542259571", "E.123", "+355 4 2259571")] + [InlineData("+35542259571", "N", "04 2259571")] + [InlineData("+35542259571", "RFC3966", "tel:+355-4-2259571")] + public void Albania_Numbers(string input, string format, string expected) => + Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format)); + [Theory] [InlineData("+375172171185", "E.123", "+375 17 2171185")] [InlineData("+375172171185", "N", "817 2171185")]