Skip to content

Commit

Permalink
Update NonGeographicPhoneNumberTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley authored Nov 3, 2024
1 parent 8366131 commit 6f2ea70
Showing 1 changed file with 35 additions and 56 deletions.
91 changes: 35 additions & 56 deletions test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,10 @@ public void Equality_Both_Null()
[Fact]
public void Equality_Same_Instance()
{
var phoneNumber1 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "7654",
NationalSignificantNumber = "7654112233",
SubscriberNumber = "112233",
};
var phoneNumber1 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPrefix: default,
ndc: "12345",
sn: "667788");
var phoneNumber2 = phoneNumber1;

Assert.Equal(phoneNumber1, phoneNumber2);
Expand All @@ -131,20 +128,15 @@ public void Equality_Same_Instance()
[Fact]
public void Equality_Same_Values_With_NationalDestinationCode()
{
var phoneNumber1 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "12345",
NationalSignificantNumber = "12345667788",
SubscriberNumber = "667788",
};
var phoneNumber2 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "12345",
NationalSignificantNumber = "12345667788",
SubscriberNumber = "667788",
};
var phoneNumber1 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPrefix: default,
ndc: "12345",
sn: "667788");

var phoneNumber2 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPredix: default,
ndc: "12345",
sn: "667788");

Assert.Equal(phoneNumber1, phoneNumber2);
Assert.True(phoneNumber1.Equals(phoneNumber2));
Expand All @@ -156,20 +148,15 @@ public void Equality_Same_Values_With_NationalDestinationCode()
[Fact]
public void Equality_Same_Values_Without_NationalDestinationCode()
{
var phoneNumber1 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = null,
NationalSignificantNumber = "667788",
SubscriberNumber = "667788",
};
var phoneNumber2 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = null,
NationalSignificantNumber = "667788",
SubscriberNumber = "667788",
};
var phoneNumber1 = TestHelper.CreateNonGeographicPhoneNumber

Check failure on line 151 in test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest)

; expected
trunkPrefix: default,

Check failure on line 152 in test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest)

; expected

Check failure on line 152 in test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest)

} expected
ndc: default,
sn: "667788");

var phoneNumber2 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPredix: default,
ndc: default,
sn: "667788");

Assert.Equal(phoneNumber1, phoneNumber2);
Assert.True(phoneNumber1.Equals(phoneNumber2));
Expand All @@ -181,13 +168,11 @@ public void Equality_Same_Values_Without_NationalDestinationCode()
[Fact]
public void Inequality()
{
var phoneNumber1 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "12345",
NationalSignificantNumber = "12345667788",
SubscriberNumber = "667788",
};
var phoneNumber1 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPrefix: default,
ndc: "12345",
sn: "667788");

var phoneNumber2 = default(NonGeographicPhoneNumber);

Assert.NotEqual(phoneNumber1, phoneNumber2);
Expand All @@ -204,27 +189,21 @@ public void Inequality()
Assert.True(phoneNumber2 != (object)phoneNumber1);

// Change national destination code
var phoneNumber3 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "12346",
NationalSignificantNumber = "12346667788",
SubscriberNumber = "667788",
};
var phoneNumber3 = TestHelper.CreateNonGeographicPhoneNumber(
trunkPrefix: default,
ndc: "12346",
sn: "667788");

Assert.NotEqual(phoneNumber1, phoneNumber3);
Assert.False(phoneNumber1.Equals(phoneNumber3));
Assert.False(phoneNumber1 == phoneNumber3);
Assert.True(phoneNumber1 != phoneNumber3);

// change subscriber number
var phoneNumber4 = new NonGeographicPhoneNumber(PhoneNumberHint.None)
{
Country = CountryInfo.UnitedKingdom,
NationalDestinationCode = "12345",
NationalSignificantNumber = "12345667789",
SubscriberNumber = "667789",
};
var phoneNumber4 = TestHelper.CreateNonGeographicPhoneNumber
trunkPrefix: default,
ndc: "12345",
sn: "667789");

Assert.NotEqual(phoneNumber1, phoneNumber4);
Assert.False(phoneNumber1.Equals(phoneNumber4));
Expand Down

0 comments on commit 6f2ea70

Please sign in to comment.