Skip to content

Commit

Permalink
premium
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley committed Nov 3, 2023
1 parent 596e3dd commit 5fc1728
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/PhoneNumbers/DataFiles/MX.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ G|6|Noroeste|100000000-999999999|
G|7|Sur oeste|100000000-999999999|
G|8|Noreste|100000000-999999999|
G|9|Sureste|100000000-109999999,129999999-999999999|
N|2-9||000000000-099999999|
N|2-8||000000000-099999999|
N|5||000000000-099999999|V
N|9||000000000-099999999|R
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,33 @@ public void Parse_Known_NonGeographicPhoneNumber_2_NationalDestinationCode(strin
Assert.Equal(subscriberNumber, nonGeographicPhoneNumber.SubscriberNumber);
}

[Theory]
[InlineData("8000000000", "8", "000000000")]
[InlineData("8099999999", "8", "099999999")]
public void Parse_Known_NonGeographicPhoneNumber_8_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();

var phoneNumber = parseResult.PhoneNumber;

Assert.NotNull(phoneNumber);
Assert.IsType<NonGeographicPhoneNumber>(phoneNumber);

var nonGeographicPhoneNumber = (NonGeographicPhoneNumber)phoneNumber;
Assert.Equal(CountryInfo.Mexico, nonGeographicPhoneNumber.Country);
Assert.False(nonGeographicPhoneNumber.IsFreephone);
Assert.False(nonGeographicPhoneNumber.IsMachineToMachine);
Assert.False(nonGeographicPhoneNumber.IsPremiumRate);
Assert.False(nonGeographicPhoneNumber.IsSharedCost);
Assert.Equal(NationalDestinationCode, nonGeographicPhoneNumber.NationalDestinationCode);
Assert.Equal(subscriberNumber, nonGeographicPhoneNumber.SubscriberNumber);
}

[Theory]
[InlineData("9000000000", "9", "000000000")]
[InlineData("9099999999", "9", "099999999")]
public void Parse_Known_NonGeographicPhoneNumber_9_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
public void Parse_Known_NonGeographicPhoneNumber_PremiumRate(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();
Expand All @@ -47,7 +70,7 @@ public void Parse_Known_NonGeographicPhoneNumber_9_NationalDestinationCode(strin
Assert.Equal(CountryInfo.Mexico, nonGeographicPhoneNumber.Country);
Assert.False(nonGeographicPhoneNumber.IsFreephone);
Assert.False(nonGeographicPhoneNumber.IsMachineToMachine);
Assert.False(nonGeographicPhoneNumber.IsPremiumRate);
Assert.True(nonGeographicPhoneNumber.IsPremiumRate);
Assert.False(nonGeographicPhoneNumber.IsSharedCost);
Assert.Equal(NationalDestinationCode, nonGeographicPhoneNumber.NationalDestinationCode);
Assert.Equal(subscriberNumber, nonGeographicPhoneNumber.SubscriberNumber);
Expand Down

0 comments on commit 5fc1728

Please sign in to comment.