diff --git a/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs b/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs index ae6888f9..6a33a032 100644 --- a/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs +++ b/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs @@ -87,14 +87,10 @@ public void Equality_Both_Null() [Fact] public void Equality_Same_Instance() { - var phoneNumber1 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = TestHelper.CreateCountryInfo(), - GeographicArea = "N/A", - NationalDestinationCode = "12345", - NationalSignificantNumber = "12345667788", - SubscriberNumber = "667788", - }; + var phoneNumber1 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12345", + sn: "667788"); var phoneNumber2 = phoneNumber1; Assert.Equal(phoneNumber1, phoneNumber2); @@ -109,22 +105,15 @@ public void Equality_Same_Instance() [Fact] public void Equality_Same_Values_With_NationalDestinationCode() { - var phoneNumber1 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = "12345", - NationalSignificantNumber = "12345667788", - SubscriberNumber = "667788", - }; - var phoneNumber2 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = "12345", - NationalSignificantNumber = "12345667788", - SubscriberNumber = "667788", - }; + var phoneNumber1 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12345", + sn: "667788"); + + var phoneNumber2 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12345", + sn: "667788"); Assert.Equal(phoneNumber1, phoneNumber2); Assert.True(phoneNumber1.Equals(phoneNumber2)); @@ -136,22 +125,15 @@ public void Equality_Same_Values_With_NationalDestinationCode() [Fact] public void Equality_Same_Values_Without_NationalDestinationCode() { - var phoneNumber1 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = null, - NationalSignificantNumber = "667788", - SubscriberNumber = "667788", - }; - var phoneNumber2 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = null, - NationalSignificantNumber = "667788", - SubscriberNumber = "667788", - }; + var phoneNumber1 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: default, + sn: "667788"); + + var phoneNumber2 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: default, + sn: "667788"); Assert.Equal(phoneNumber1, phoneNumber2); Assert.True(phoneNumber1.Equals(phoneNumber2)); @@ -163,14 +145,11 @@ public void Equality_Same_Values_Without_NationalDestinationCode() [Fact] public void Inequality() { - var phoneNumber1 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = "12345", - NationalSignificantNumber = "12345667788", - SubscriberNumber = "667788", - }; + var phoneNumber1 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12345", + sn: "667788"); + var phoneNumber2 = default(GeographicPhoneNumber); Assert.NotEqual(phoneNumber1, phoneNumber2); @@ -187,14 +166,10 @@ public void Inequality() Assert.True(phoneNumber2 != (object)phoneNumber1); // Change national destination code - var phoneNumber3 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = "12346", - NationalSignificantNumber = "12346667788", - SubscriberNumber = "667788", - }; + var phoneNumber3 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12346", + sn: "667788"); Assert.NotEqual(phoneNumber1, phoneNumber3); Assert.False(phoneNumber1.Equals(phoneNumber3)); @@ -202,14 +177,10 @@ public void Inequality() Assert.True(phoneNumber1 != phoneNumber3); // change subscriber number - var phoneNumber4 = new GeographicPhoneNumber(PhoneNumberHint.None) - { - Country = CountryInfo.UnitedKingdom, - GeographicArea = "N/A", - NationalDestinationCode = "12345", - NationalSignificantNumber = "12345667789", - SubscriberNumber = "667789", - }; + var phoneNumber4 = TestHelper.CreateGeographicPhoneNumber( + trunkPredix: default, + ndc: "12345", + sn: "667789"); Assert.NotEqual(phoneNumber1, phoneNumber4); Assert.False(phoneNumber1.Equals(phoneNumber4));