Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley committed Nov 21, 2024
1 parent 3fa8493 commit 5436a3a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/PhoneNumbers.Tests/PhoneNumber_ToString_Europe_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ public void SanMarino_Numbers(string input, string format, string expected) =>
[InlineData("+381112026828", "E.123", "+381 11 202 6828")]
[InlineData("+381112026828", "N", "(011) 202 6828")]
[InlineData("+381112026828", "RFC3966", "tel:+381-11-202-6828")]
[InlineData("+381112026828", "TAPI", "+381 (11) 202 6828")]
[InlineData("+381112026828", "U", "0112026828")]
public void Serbia_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -442,6 +443,9 @@ public void Serbia_Numbers(string input, string format, string expected) =>
[InlineData("+421257881101", "RFC3966", "tel:+421-2-5788-1101")]
[InlineData("+421415005178", "RFC3966", "tel:+421-41-500-5178")]
[InlineData("+421949554223", "RFC3966", "tel:+421-949-554-223")]
[InlineData("+421257881101", "TAPI", "+421 (2) 5788 1101")]
[InlineData("+421415005178", "TAPI", "+421 (41) 500 5178")]
[InlineData("+421949554223", "TAPI", "+421 (949) 554 223")]
[InlineData("+421257881101", "U", "0257881101")]
[InlineData("+421415005178", "U", "0415005178")]
[InlineData("+421949554223", "U", "0949554223")]
Expand All @@ -458,6 +462,9 @@ public void Slovakia_Numbers(string input, string format, string expected) =>
[InlineData("+38615836300", "RFC3966", "tel:+386-1-583-63-00")]
[InlineData("+38630123654", "RFC3966", "tel:+386-30-123-654")]
[InlineData("+38665012365", "RFC3966", "tel:+386-650-12-365")]
[InlineData("+38615836300", "TAPI", "+386 (1) 583 63 00")]
[InlineData("+38630123654", "TAPI", "+386 (30) 123 654")]
[InlineData("+38665012365", "TAPI", "+386 (650) 12 365")]
[InlineData("+38615836300", "U", "015836300")]
[InlineData("+38630123654", "U", "030123654")]
[InlineData("+38665012365", "U", "065012365")]
Expand All @@ -471,6 +478,8 @@ public void Slovenia_Numbers(string input, string format, string expected) =>
[InlineData("+34902189900", "N", "902 189 900")] // 3-3-3 where the NDC is 3 digits
[InlineData("+34912582852", "RFC3966", "tel:+34-91-258-28-52")] // 2-3-2-2 where the NDC is 2 digits (applicable for Madrid & Barcelona)
[InlineData("+34902189900", "RFC3966", "tel:+34-902-189-900")] // 3-3-3 where the NDC is 3 digits
[InlineData("+34912582852", "TAPI", "+34 (91) 258 28 52")] // 2-3-2-2 where the NDC is 2 digits (applicable for Madrid & Barcelona)
[InlineData("+34902189900", "TAPI", "+34 (902) 189 900")] // 3-3-3 where the NDC is 3 digits
[InlineData("+34912582852", "U", "912582852")]
[InlineData("+34902189900", "U", "902189900")]
public void Spain_Numbers(string input, string format, string expected) =>
Expand Down Expand Up @@ -519,6 +528,20 @@ public void Spain_Numbers(string input, string format, string expected) =>
[InlineData("+46640678550", "RFC3966", "tel:+46-640-67-85-50")]
[InlineData("+4690012345", "RFC3966", "tel:+46-900-123-45")]
[InlineData("+46900123456", "RFC3966", "tel:+46-900-12-34-56")]
[InlineData("+46201234", "TAPI", "+46 (20) 1234")]
[InlineData("+462012345", "TAPI", "+46 (20) 123 45")]
[InlineData("+4620123456", "TAPI", "+46 (20) 12 34 56")]
[InlineData("+468678550", "TAPI", "+46 8 67 85 50")]
[InlineData("+4686785500", "TAPI", "+46 8 678 55 00")]
[InlineData("+46867855001", "TAPI", "+46 8 678 550 01")]
[InlineData("+46777855001", "TAPI", "+46 77 785 50 01")]
[InlineData("+469067855", "TAPI", "+46 90 678 55")]
[InlineData("+4690678550", "TAPI", "+46 90 67 85 50")]
[InlineData("+46906785500", "TAPI", "+46 90 678 55 00")]
[InlineData("+4664067855", "TAPI", "+46 (640) 678 55")]
[InlineData("+46640678550", "TAPI", "+46 (640) 67 85 50")]
[InlineData("+4690012345", "TAPI", "+46 (900) 123 45")]
[InlineData("+46900123456", "TAPI", "+46 (900) 12 34 56")]
[InlineData("+46201234", "U", "0201234")]
[InlineData("+462012345", "U", "02012345")]
[InlineData("+4620123456", "U", "020123456")]
Expand All @@ -543,6 +566,8 @@ public void Sweden_Numbers(string input, string format, string expected) =>
[InlineData("+41840545987", "N", "0840 545 987")] // 3-3-3 where the NDC is 3 digits
[InlineData("+41584605511", "RFC3966", "tel:+41-58-460-55-11")] // 2-3-2-2 where the NDC is 2 digits
[InlineData("+41840545987", "RFC3966", "tel:+41-840-545-987")] // 3-3-3 where the NDC is 3 digits
[InlineData("+41584605511", "TAPI", "+41 (58) 460 55 11")] // 2-3-2-2 where the NDC is 2 digits
[InlineData("+41840545987", "TAPI", "+41 (840) 545 987")] // 3-3-3 where the NDC is 3 digits
[InlineData("+41584605511", "U", "0584605511")]
[InlineData("+41840545987", "U", "0840545987")]
public void Switzerland_Numbers(string input, string format, string expected) =>
Expand All @@ -555,6 +580,8 @@ public void Switzerland_Numbers(string input, string format, string expected) =>
[InlineData("+380891233456", "N", "0891 233 456")]
[InlineData("+380442819196", "RFC3966", "tel:+380-44-281-91-96")]
[InlineData("+380891233456", "RFC3966", "tel:+380-891-233-456")]
[InlineData("+380442819196", "TAPI", "+380 (44) 281 91 96")]
[InlineData("+380891233456", "TAPI", "+380 (891) 233 456")]
[InlineData("+380442819196", "U", "0442819196")]
[InlineData("+380891233456", "U", "0891233456")]
public void Ukraine_Numbers(string input, string format, string expected) =>
Expand Down
22 changes: 22 additions & 0 deletions test/PhoneNumbers.Tests/PhoneNumber_ToString_NorthAmerica_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class PhoneNumber_ToString_NorthAmerica_Tests
[InlineData("+12644972442", "E.123", "+1 264-497-2442")]
[InlineData("+12644972442", "N", "(264) 497-2442")]
[InlineData("+12644972442", "RFC3966", "tel:+1-264-497-2442")]
[InlineData("+12644972442", "TAPI", "+1 (264) 497-2442")]
[InlineData("+12644972442", "U", "2644972442")]
public void Anguilla_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -14,6 +15,7 @@ public void Anguilla_Numbers(string input, string format, string expected) =>
[InlineData("+12684804405", "E.123", "+1 268-480-4405")]
[InlineData("+12684804405", "N", "(268) 480-4405")]
[InlineData("+12684804405", "RFC3966", "tel:+1-268-480-4405")]
[InlineData("+12684804405", "TAPI", "+1 (268) 480-4405")]
[InlineData("+12684804405", "U", "2684804405")]
public void AntiguaAndBarbuda_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -22,6 +24,7 @@ public void AntiguaAndBarbuda_Numbers(string input, string format, string expect
[InlineData("+12423930234", "E.123", "+1 242-393-0234")]
[InlineData("+12423930234", "N", "(242) 393-0234")]
[InlineData("+12423930234", "RFC3966", "tel:+1-242-393-0234")]
[InlineData("+12423930234", "TAPI", "+1 (242) 393-0234")]
[InlineData("+12423930234", "U", "2423930234")]
public void Bahamas_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -30,6 +33,7 @@ public void Bahamas_Numbers(string input, string format, string expected) =>
[InlineData("+12465352573", "E.123", "+1 246-535-2573")]
[InlineData("+12465352573", "N", "(246) 535-2573")]
[InlineData("+12465352573", "RFC3966", "tel:+1-246-535-2573")]
[InlineData("+12465352573", "E.123", "+1 (246) 535-2573")]
[InlineData("+12465352573", "U", "2465352573")]
public void Barbados_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -38,6 +42,7 @@ public void Barbados_Numbers(string input, string format, string expected) =>
[InlineData("+14414056000", "E.123", "+1 441-405-6000")]
[InlineData("+14414056000", "N", "(441) 405-6000")]
[InlineData("+14414056000", "RFC3966", "tel:+1-441-405-6000")]
[InlineData("+14414056000", "TAPI", "+1 (441) 405-6000")]
[InlineData("+14414056000", "U", "4414056000")]
public void Bermuda_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -46,6 +51,7 @@ public void Bermuda_Numbers(string input, string format, string expected) =>
[InlineData("+12844946786", "E.123", "+1 284-494-6786")]
[InlineData("+12844946786", "N", "(284) 494-6786")]
[InlineData("+12844946786", "RFC3966", "tel:+1-284-494-6786")]
[InlineData("+12844946786", "TAPI", "+1 (284) 494-6786")]
[InlineData("+12844946786", "U", "2844946786")]
public void BritishVirginIslands_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -54,6 +60,7 @@ public void BritishVirginIslands_Numbers(string input, string format, string exp
[InlineData("+16137020016", "E.123", "+1 613-702-0016")]
[InlineData("+16137020016", "N", "(613) 702-0016")]
[InlineData("+16137020016", "RFC3966", "tel:+1-613-702-0016")]
[InlineData("+16137020016", "TAPI", "+1 (613) 702-0016")]
[InlineData("+16137020016", "U", "6137020016")]
public void Canada_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -62,6 +69,7 @@ public void Canada_Numbers(string input, string format, string expected) =>
[InlineData("+13459464282", "E.123", "+1 345-946-4282")]
[InlineData("+13459464282", "N", "(345) 946-4282")]
[InlineData("+13459464282", "RFC3966", "tel:+1-345-946-4282")]
[InlineData("+13459464282", "TAPI", "+1 (345) 946-4282")]
[InlineData("+13459464282", "U", "3459464282")]
public void CaymanIslands_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -70,6 +78,7 @@ public void CaymanIslands_Numbers(string input, string format, string expected)
[InlineData("+17677011252", "E.123", "+1 767-701-1252")]
[InlineData("+17677011252", "N", "(767) 701-1252")]
[InlineData("+17677011252", "RFC3966", "tel:+1-767-701-1252")]
[InlineData("+17677011252", "TAPI", "+1 (767) 701-1252")]
[InlineData("+17677011252", "U", "7677011252")]
public void Dominica_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -78,6 +87,7 @@ public void Dominica_Numbers(string input, string format, string expected) =>
[InlineData("+14734081342", "E.123", "+1 473-408-1342")]
[InlineData("+14734081342", "N", "(473) 408-1342")]
[InlineData("+14734081342", "RFC3966", "tel:+1-473-408-1342")]
[InlineData("+14734081342", "TAPI", "+1 (473) 408-1342")]
[InlineData("+14734081342", "U", "4734081342")]
public void Grenada_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -86,6 +96,7 @@ public void Grenada_Numbers(string input, string format, string expected) =>
[InlineData("+18769686053", "E.123", "+1 876-968-6053")]
[InlineData("+18769686053", "N", "(876) 968-6053")]
[InlineData("+18769686053", "RFC3966", "tel:+1-876-968-6053")]
[InlineData("+18769686053", "TAPI", "+1 (876) 968-6053")]
[InlineData("+18769686053", "U", "8769686053")]
public void Jamaica_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -94,6 +105,7 @@ public void Jamaica_Numbers(string input, string format, string expected) =>
[InlineData("+16644913789", "E.123", "+1 664-491-3789")]
[InlineData("+16644913789", "N", "(664) 491-3789")]
[InlineData("+16644913789", "RFC3966", "tel:+1-664-491-3789")]
[InlineData("+16644913789", "TAPI", "+1 (664) 491-3789")]
[InlineData("+16644913789", "U", "6644913789")]
public void Montserrat_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -102,6 +114,7 @@ public void Montserrat_Numbers(string input, string format, string expected) =>
[InlineData("+16702202200", "E.123", "+1 670-220-2200")]
[InlineData("+16702202200", "N", "(670) 220-2200")]
[InlineData("+16702202200", "RFC3966", "tel:+1-670-220-2200")]
[InlineData("+16702202200", "TAPI", "+1 (670) 220-2200")]
[InlineData("+16702202200", "U", "6702202200")]
public void NorthernMarianaIsland_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -110,6 +123,7 @@ public void NorthernMarianaIsland_Numbers(string input, string format, string ex
[InlineData("+17877222977", "E.123", "+1 787-722-2977")]
[InlineData("+17877222977", "N", "(787) 722-2977")]
[InlineData("+17877222977", "RFC3966", "tel:+1-787-722-2977")]
[InlineData("+17877222977", "TAPI", "+1 (787) 722-2977")]
[InlineData("+17877222977", "U", "7877222977")]
public void PuertoRico_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -118,6 +132,7 @@ public void PuertoRico_Numbers(string input, string format, string expected) =>
[InlineData("+18692291432", "E.123", "+1 869-229-1432")]
[InlineData("+18692291432", "N", "(869) 229-1432")]
[InlineData("+18692291432", "RFC3966", "tel:+1-869-229-1432")]
[InlineData("+18692291432", "TAPI", "+1 (869) 229-1432")]
[InlineData("+18692291432", "U", "8692291432")]
public void SaintKittsAndNevis_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -126,6 +141,7 @@ public void SaintKittsAndNevis_Numbers(string input, string format, string expec
[InlineData("+17584581701", "E.123", "+1 758-458-1701")]
[InlineData("+17584581701", "N", "(758) 458-1701")]
[InlineData("+17584581701", "RFC3966", "tel:+1-758-458-1701")]
[InlineData("+17584581701", "TAPI", "+1 (758) 458-1701")]
[InlineData("+17584581701", "U", "7584581701")]
public void SaintLucia_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -134,6 +150,7 @@ public void SaintLucia_Numbers(string input, string format, string expected) =>
[InlineData("+17842664245", "E.123", "+1 784-266-4245")]
[InlineData("+17842664245", "N", "(784) 266-4245")]
[InlineData("+17842664245", "RFC3966", "tel:+1-784-266-4245")]
[InlineData("+17842664245", "TAPI", "+1 (784) 266-4245")]
[InlineData("+17842664245", "U", "7842664245")]
public void SaintVincentAndTheGrenadines_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -142,6 +159,7 @@ public void SaintVincentAndTheGrenadines_Numbers(string input, string format, st
[InlineData("+17215425557", "E.123", "+1 721-542-5557")]
[InlineData("+17215425557", "N", "(721) 542-5557")]
[InlineData("+17215425557", "RFC3966", "tel:+1-721-542-5557")]
[InlineData("+17215425557", "TAPI", "+1 (721) 542-5557")]
[InlineData("+17215425557", "U", "7215425557")]
public void SintMaarten_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -150,6 +168,7 @@ public void SintMaarten_Numbers(string input, string format, string expected) =>
[InlineData("+18686758288", "E.123", "+1 868-675-8288")]
[InlineData("+18686758288", "N", "(868) 675-8288")]
[InlineData("+18686758288", "RFC3966", "tel:+1-868-675-8288")]
[InlineData("+18686758288", "TAPI", "+1 (868) 675-8288")]
[InlineData("+18686758288", "U", "8686758288")]
public void TrinidadAndTobago_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -158,6 +177,7 @@ public void TrinidadAndTobago_Numbers(string input, string format, string expect
[InlineData("+16499461900", "E.123", "+1 649-946-1900")]
[InlineData("+16499461900", "N", "(649) 946-1900")]
[InlineData("+16499461900", "RFC3966", "tel:+1-649-946-1900")]
[InlineData("+16499461900", "TAPI", "+1 (649) 946-1900")]
[InlineData("+16499461900", "U", "6499461900")]
public void TurksAndCaicosIslands_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -166,6 +186,7 @@ public void TurksAndCaicosIslands_Numbers(string input, string format, string ex
[InlineData("+13407731404", "E.123", "+1 340-773-1404")]
[InlineData("+13407731404", "N", "(340) 773-1404")]
[InlineData("+13407731404", "RFC3966", "tel:+1-340-773-1404")]
[InlineData("+13407731404", "TAPI", "+1 (340) 773-1404")]
[InlineData("+13407731404", "U", "3407731404")]
public void UnitedStatesVirginIslands_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -174,6 +195,7 @@ public void UnitedStatesVirginIslands_Numbers(string input, string format, strin
[InlineData("+12124841200", "E.123", "+1 212-484-1200")]
[InlineData("+12124841200", "N", "(212) 484-1200")]
[InlineData("+12124841200", "RFC3966", "tel:+1-212-484-1200")]
[InlineData("+12124841200", "TAPI", "+1 (212) 484-1200")]
[InlineData("+12124841200", "U", "2124841200")]
public void UnitedStates_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand Down
7 changes: 7 additions & 0 deletions test/PhoneNumbers.Tests/PhoneNumber_ToString_Oceania_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class PhoneNumber_ToString_Oceania_Tests
[InlineData("+16846339805", "E.123", "+1 684-633-9805")]
[InlineData("+16846339805", "N", "(684) 633-9805")]
[InlineData("+16846339805", "RFC3966", "tel:+1-684-633-9805")]
[InlineData("+16846339805", "TAPI", "+1 (684) 633-9805")]
[InlineData("+16846339805", "U", "6846339805")]
public void AmericanSamoa_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -23,6 +24,10 @@ public void AmericanSamoa_Numbers(string input, string format, string expected)
[InlineData("+61399636800", "RFC3966", "tel:+61-3-9963-6800")]
[InlineData("+61436986301", "RFC3966", "tel:+61-436-986-301")]
[InlineData("+611800900090", "RFC3966", "tel:+61-1800-900-090")]
[InlineData("+61131234", "TAPI", "+61 (13) 1234")]
//[InlineData("+61399636800", "TAPI", "+61 (3) 9963 6800")]
// [InlineData("+61436986301", "TAPI", "+61 (436) 986 301")]
// [InlineData("+611800900090", "TAPI", "+61 (1800) 900 090")]
[InlineData("+61131234", "U", "0131234")]
[InlineData("+61399636800", "U", "0399636800")]
[InlineData("+61436986301", "U", "0436986301")]
Expand All @@ -34,6 +39,7 @@ public void Australia_Numbers(string input, string format, string expected) =>
[InlineData("+16716323365", "E.123", "+1 671-632-3365")]
[InlineData("+16716323365", "N", "(671) 632-3365")]
[InlineData("+16716323365", "RFC3966", "tel:+1-671-632-3365")]
[InlineData("+16716323365", "TAPI", "+1 (671) 632-3365")]
[InlineData("+16716323365", "U", "6716323365")]
public void Guam_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand All @@ -42,6 +48,7 @@ public void Guam_Numbers(string input, string format, string expected) =>
[InlineData("+6753033201", "E.123", "+675 303 3201")]
[InlineData("+6753033201", "N", "303 3201")]
[InlineData("+6753033201", "RFC3966", "tel:+675-303-3201")]
[InlineData("+6753033201", "TAPI", "+675 (303) 3201")]
[InlineData("+6753033201", "U", "3033201")]
public void PapuaNewGuinea_Numbers(string input, string format, string expected) =>
Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));
Expand Down

0 comments on commit 5436a3a

Please sign in to comment.