diff --git a/test/PhoneNumbers.Tests/ParseOptionsTests.cs b/test/PhoneNumbers.Tests/ParseOptionsTests.cs index 5acbfc80c..7b69aea17 100644 --- a/test/PhoneNumbers.Tests/ParseOptionsTests.cs +++ b/test/PhoneNumbers.Tests/ParseOptionsTests.cs @@ -1,3 +1,4 @@ +using System; using System.Reflection; namespace PhoneNumbers.Tests; @@ -125,6 +126,18 @@ public void Default() Assert.Equal(countryInfos, ParseOptions.Default.Countries); } + [Fact] + public void Extensions_Throw_If_ParseOptions_Null() + { + var parseOptions = default(ParseOptions); + + typeof(ParseOptions) + .GetMethods(BindingFlags.Static | BindingFlags.Public) + .Where(x => x.GetParameters().Length == 1 && x.GetParameters()[0].ParameterType == typeof(ParseOptions)) + .ToList() + .ForEach(x => Assert.Throws(() => x.Invoke(null, [parseOptions]))); + } + [Fact] public void GetCountryInfo_Does_Not_Exist() => Assert.Null(ParseOptions.Default.GetCountryInfo("ZZ"));