From 6f2ea70af9eb4a6c74da04f7703f084920d8a8a3 Mon Sep 17 00:00:00 2001 From: Trevor Pilley Date: Sun, 3 Nov 2024 21:47:15 +0000 Subject: [PATCH] Update NonGeographicPhoneNumberTests.cs --- .../NonGeographicPhoneNumberTests.cs | 91 +++++++------------ 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs b/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs index e915d805..54a4bde6 100644 --- a/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs +++ b/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs @@ -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); @@ -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)); @@ -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 + trunkPrefix: default, + ndc: default, + sn: "667788"); + + var phoneNumber2 = TestHelper.CreateNonGeographicPhoneNumber( + trunkPredix: default, + ndc: default, + sn: "667788"); Assert.Equal(phoneNumber1, phoneNumber2); Assert.True(phoneNumber1.Equals(phoneNumber2)); @@ -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); @@ -204,13 +189,10 @@ 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)); @@ -218,13 +200,10 @@ public void Inequality() 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));