Skip to content

Commit

Permalink
Closes #723
Browse files Browse the repository at this point in the history
Add more german mobile provider numbers
  • Loading branch information
TrevorPilley authored Oct 28, 2024
1 parent d550c11 commit ec50976
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/PhoneNumbers/CountryInfo_Europe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public partial class CountryInfo
/// </summary>
public static CountryInfo Germany { get; } = new()
{
AllowsLocalGeographicDialling = true,
CallingCode = "49",
Continent = Europe,
FormatProvider = SimplePhoneNumberFormatProvider.Default,
Expand Down
10 changes: 6 additions & 4 deletions src/PhoneNumbers/DataFiles/DE.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Reference: https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000510006PDFE.pdf
# Reference Date: 25/08/2022
# Reference: https://www.bundesnetzagentur.de/EN/Areas/Telecommunications/NumberManagement/start.html
N|137||0000000-9999999|
M|15019,15180-15181,15310,15510-15511,15566,15630,15678-15679,15888||000000-999999|
M|1511-1512,1514-1517,1520-1523,1525-1526,1529,1570,1573,1575,1577-1579,1590||0000000-9999999|
M|160||0000000-8999999|
M|1609,162-163,170-175,177-179||0000000-9999999|
M|15019-15020,15180-15183,15310,15510-15511,15560-15569,15630,15678-15679,15700-15704,15706,15888||000000-999999|
M|1511-1512,1514-1517,1520-1523,1525-1526,1529,1573,1575,1577-1579,1590||0000000-9999999|
M|1600-1608||000000-999999|
M|1609||0000000-9999999|
M|162-163,170-175,177-179||0000000-9999999|
M|164||0-9999999999|P
M|168-169||0-99999999999|P
M|176||00000000-99999999|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
[Theory]
[InlineData("015019000000", "15019", "000000")]
[InlineData("015019999999", "15019", "999999")]
[InlineData("015020000000", "15020", "000000")]
[InlineData("015020999999", "15020", "999999")]
[InlineData("015110000000", "1511", "0000000")]
[InlineData("015119999999", "1511", "9999999")]
[InlineData("015120000000", "1512", "0000000")]
Expand All @@ -20,8 +22,8 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
[InlineData("015179999999", "1517", "9999999")]
[InlineData("015180000000", "15180", "000000")]
[InlineData("015180999999", "15180", "999999")]
[InlineData("015181000000", "15181", "000000")]
[InlineData("015181999999", "15181", "999999")]
[InlineData("015183000000", "15183", "000000")]
[InlineData("015183999999", "15183", "999999")]
[InlineData("015200000000", "1520", "0000000")]
[InlineData("015209999999", "1520", "9999999")]
[InlineData("015230000000", "1523", "0000000")]
Expand All @@ -38,16 +40,22 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
[InlineData("015510999999", "15510", "999999")]
[InlineData("015511000000", "15511", "000000")]
[InlineData("015511999999", "15511", "999999")]
[InlineData("015566000000", "15566", "000000")]
[InlineData("015566999999", "15566", "999999")]
[InlineData("015560000000", "15560", "000000")]
[InlineData("015560999999", "15560", "999999")]
[InlineData("015569000000", "15569", "000000")]
[InlineData("015569999999", "15569", "999999")]
[InlineData("015630000000", "15630", "000000")]
[InlineData("015630999999", "15630", "999999")]
[InlineData("015678000000", "15678", "000000")]
[InlineData("015678999999", "15678", "999999")]
[InlineData("015679000000", "15679", "000000")]
[InlineData("015679999999", "15679", "999999")]
[InlineData("015700000000", "1570", "0000000")]
[InlineData("015709999999", "1570", "9999999")]
[InlineData("015700000000", "15700", "000000")]
[InlineData("015700999999", "15700", "999999")]
[InlineData("015704000000", "15704", "000000")]
[InlineData("015704999999", "15704", "999999")]
[InlineData("015706000000", "15706", "000000")]
[InlineData("015706999999", "15706", "999999")]
[InlineData("015730000000", "1573", "0000000")]
[InlineData("015739999999", "1573", "9999999")]
[InlineData("015750000000", "1575", "0000000")]
Expand Down Expand Up @@ -79,15 +87,17 @@ public void Parse_Known_MobilePhoneNumber_15XXX_NationalDestinationCode(string v
}

[Theory]
[InlineData("01600000000", "160", "0000000")]
[InlineData("01608999999", "160", "8999999")]
[InlineData("01600000000", "1600", "000000")]
[InlineData("01600999999", "1600", "999999")]
[InlineData("01608000000", "1608", "000000")]
[InlineData("01608999999", "1608", "999999")]
[InlineData("016090000000", "1609", "0000000")]
[InlineData("016099999999", "1609", "9999999")]
[InlineData("01620000000", "162", "0000000")]
[InlineData("01629999999", "162", "9999999")]
[InlineData("01630000000", "163", "0000000")]
[InlineData("01639999999", "163", "9999999")]
public void Parse_Known_MobilePhoneNumber_16X_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
public void Parse_Known_MobilePhoneNumber_16XX_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();
Expand Down
2 changes: 1 addition & 1 deletion test/PhoneNumbers.Tests/CountryInfo_Europe_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void CountryInfo_Germany()

var countryInfo = CountryInfo.Germany;

Assert.False(countryInfo.AllowsLocalGeographicDialling);
Assert.True(countryInfo.AllowsLocalGeographicDialling);
Assert.Equal("49", countryInfo.CallingCode);
Assert.Equal(CountryInfo.Europe, countryInfo.Continent);
Assert.IsType<SimplePhoneNumberFormatProvider>(countryInfo.FormatProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void France_Numbers(string input, string format, string expected) =>

[Theory]
[InlineData("+49228141177", "E.123", "+49 228 141177")]
[InlineData("+49228141177", "N", "0228 141177")]
[InlineData("+49228141177", "N", "(0228) 141177")]
[InlineData("+49228141177", "RFC3966", "tel:+49-228-141177")]
public void Germany_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand Down

0 comments on commit ec50976

Please sign in to comment.