Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley committed Nov 21, 2023
1 parent 7b60477 commit a17c51e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/PhoneNumbers.Tests/ParseOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Reflection;

namespace PhoneNumbers.Tests;
Expand Down Expand Up @@ -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<ArgumentNullException>(() => x.Invoke(null, [parseOptions])));
}

[Fact]
public void GetCountryInfo_Does_Not_Exist() =>
Assert.Null(ParseOptions.Default.GetCountryInfo("ZZ"));
Expand Down

0 comments on commit a17c51e

Please sign in to comment.