Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley committed Nov 28, 2024
1 parent 20113e8 commit 882b646
Show file tree
Hide file tree
Showing 2 changed files with 605 additions and 0 deletions.
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);
}
}
Loading

0 comments on commit 882b646

Please sign in to comment.