diff --git a/src/PhoneNumbers/Formatters/FormatProviders/AUPhoneNumberFormatProvider.cs b/src/PhoneNumbers/Formatters/FormatProviders/AUPhoneNumberFormatProvider.cs index 8ac965de..6725dba8 100644 --- a/src/PhoneNumbers/Formatters/FormatProviders/AUPhoneNumberFormatProvider.cs +++ b/src/PhoneNumbers/Formatters/FormatProviders/AUPhoneNumberFormatProvider.cs @@ -11,8 +11,15 @@ private AUPhoneNumberFormatProvider() internal static PhoneNumberFormatProvider Instance { get; } = new AUPhoneNumberFormatProvider(); - protected override string ProvideFormat(PhoneNumber phoneNumber, bool international) => - phoneNumber.NationalSignificantNumber.Length switch + protected override string ProvideFormat(PhoneNumber phoneNumber, bool international) + { + if (phoneNumber is NonGeographicPhoneNumber nonGeographicPhoneNumber && + nonGeographicPhoneNumber.IsFreephone) + { + return "#### ### ###"; + } + + return phoneNumber.NationalSignificantNumber.Length switch { 9 => phoneNumber.Kind switch { @@ -21,4 +28,5 @@ protected override string ProvideFormat(PhoneNumber phoneNumber, bool internatio }, _ => base.ProvideFormat(phoneNumber, international), }; + } } diff --git a/test/PhoneNumbers.Tests/PhoneNumber_ToString_Oceania_Tests.cs b/test/PhoneNumbers.Tests/PhoneNumber_ToString_Oceania_Tests.cs index 910ae6f0..f411b22d 100644 --- a/test/PhoneNumbers.Tests/PhoneNumber_ToString_Oceania_Tests.cs +++ b/test/PhoneNumbers.Tests/PhoneNumber_ToString_Oceania_Tests.cs @@ -12,10 +12,13 @@ public void AmericanSamoa_Numbers(string input, string format, string expected) [Theory] [InlineData("+61399636800", "E.123", "+61 3 9963 6800")] [InlineData("+61436986301", "E.123", "+61 436 986 301")] + [InlineData("+611800900090", "E.123", "+61 1800 900 090")] [InlineData("+61399636800", "N", "(03) 9963 6800")] [InlineData("+61436986301", "N", "0436 986 301")] + [InlineData("+611800900090", "N", "1800 900 090")] [InlineData("+61399636800", "RFC3966", "tel:+61-3-9963-6800")] [InlineData("+61436986301", "RFC3966", "tel:+61-436-986-301")] + [InlineData("+611800900090", "RFC3966", "tel:+61-1800-900-090")] public void Australia_Numbers(string input, string format, string expected) => Assert.Equal(expected, PhoneNumber.Parse(input).ToString(format));