Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley committed Nov 3, 2024
1 parent 802a331 commit 7a1fb1e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/PhoneNumbers/CountryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ internal CountryInfo()
s_emptyIntArray;
#endif

/// <inheritdoc/>
public static bool operator !=(CountryInfo? countryInfo1, CountryInfo? countryInfo2) =>
!(countryInfo1 == countryInfo2);

Check warning on line 121 in src/PhoneNumbers/CountryInfo.cs

View check run for this annotation

Codecov / codecov/patch

src/PhoneNumbers/CountryInfo.cs#L121

Added line #L121 was not covered by tests

/// <inheritdoc/>
public static bool operator ==(CountryInfo? countryInfo1, CountryInfo? countryInfo2)
{
if (countryInfo1 is null)
{
return countryInfo2 is null;

Check warning on line 128 in src/PhoneNumbers/CountryInfo.cs

View check run for this annotation

Codecov / codecov/patch

src/PhoneNumbers/CountryInfo.cs#L128

Added line #L128 was not covered by tests
}

return countryInfo1.Equals(countryInfo2);
}

internal static IEnumerable<CountryInfo> GetCountries() =>
typeof(CountryInfo)
.GetProperties(BindingFlags.Public | BindingFlags.Static)
Expand All @@ -135,22 +150,6 @@ internal static IEnumerable<CountryInfo> GetCountries(Func<CountryInfo, bool> pr
internal static PhoneNumberFormatter GetFormatter(string format) =>
s_formatters.SingleOrDefault(x => x.CanFormat(format)) ?? throw new FormatException($"{format} is not a supported format");


/// <inheritdoc/>
public static bool operator !=(CountryInfo? countryInfo1, CountryInfo? countryInfo2) =>
!(countryInfo1 == countryInfo2);

/// <inheritdoc/>
public static bool operator ==(CountryInfo? countryInfo1, CountryInfo? countryInfo2)
{
if (countryInfo1 is null)
{
return countryInfo2 is null;
}

return countryInfo1.Equals(countryInfo2);
}

/// <inheritdoc/>
public override bool Equals(object? obj) =>
Equals(obj as CountryInfo);

Check warning on line 155 in src/PhoneNumbers/CountryInfo.cs

View check run for this annotation

Codecov / codecov/patch

src/PhoneNumbers/CountryInfo.cs#L155

Added line #L155 was not covered by tests
Expand Down

0 comments on commit 7a1fb1e

Please sign in to comment.