-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20113e8
commit 882b646
Showing
2 changed files
with
605 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
test/PhoneNumbers.Data.Tests/Parsers/DefaultPhoneNumberParserTests_AL_MobilePhoneNumber.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
namespace PhoneNumbers.Tests.Parsers; | ||
|
||
/// <summary> | ||
/// Contains unit tests for the <see cref="DefaultPhoneNumberParser"/> class for Albania <see cref="PhoneNumber"/>s. | ||
/// </summary> | ||
public class DefaultPhoneNumberParserTests_AL_MobilePhoneNumber | ||
{ | ||
private static readonly PhoneNumberParser s_parser = DefaultPhoneNumberParser.Create(CountryInfo.Albania); | ||
|
||
[Theory] | ||
[InlineData("062200000", "62200000")] | ||
[InlineData("069999999", "69999999")] | ||
public void Parse_Known_MobilePhoneNumber(string value, string subscriberNumber) | ||
{ | ||
var parseResult = s_parser.Parse(value); | ||
parseResult.ThrowIfFailure(); | ||
|
||
var phoneNumber = parseResult.PhoneNumber; | ||
|
||
Assert.NotNull(phoneNumber); | ||
Assert.IsType<MobilePhoneNumber>(phoneNumber); | ||
|
||
var mobilePhoneNumber = (MobilePhoneNumber)phoneNumber; | ||
Assert.Equal(CountryInfo.Albania, mobilePhoneNumber.Country); | ||
Assert.False(mobilePhoneNumber.IsPager); | ||
Assert.False(mobilePhoneNumber.IsVirtual); | ||
Assert.Null(mobilePhoneNumber.NationalDestinationCode); | ||
Assert.Equal(subscriberNumber, mobilePhoneNumber.SubscriberNumber); | ||
} | ||
|
||
[Theory] | ||
[InlineData("070020000", "70020000")] | ||
[InlineData("070099999", "70099999")] | ||
public void Parse_Known_MobilePhoneNumber_Virtual(string value, string subscriberNumber) | ||
{ | ||
var parseResult = s_parser.Parse(value); | ||
parseResult.ThrowIfFailure(); | ||
|
||
var phoneNumber = parseResult.PhoneNumber; | ||
|
||
Assert.NotNull(phoneNumber); | ||
Assert.IsType<MobilePhoneNumber>(phoneNumber); | ||
|
||
var mobilePhoneNumber = (MobilePhoneNumber)phoneNumber; | ||
Assert.Equal(CountryInfo.Albania, mobilePhoneNumber.Country); | ||
Assert.False(mobilePhoneNumber.IsPager); | ||
Assert.True(mobilePhoneNumber.IsVirtual); | ||
Assert.Null(mobilePhoneNumber.NationalDestinationCode); | ||
Assert.Equal(subscriberNumber, mobilePhoneNumber.SubscriberNumber); | ||
} | ||
} |
Oops, something went wrong.