From a7a635d854adf50140e10d74dcd0e4996e0fa859 Mon Sep 17 00:00:00 2001 From: Trevor Pilley Date: Sun, 3 Nov 2024 22:27:36 +0000 Subject: [PATCH] Fix --- .../GeographicPhoneNumberTests.cs | 15 ++++++++++----- test/PhoneNumbers.Tests/MobilePhoneNumberTests.cs | 14 ++++++++++++++ .../NonGeographicPhoneNumberTests.cs | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs b/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs index ff19bc2f..2102c0ca 100644 --- a/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs +++ b/test/PhoneNumbers.Tests/GeographicPhoneNumberTests.cs @@ -187,14 +187,19 @@ public void Inequality() Assert.False(phoneNumber1 == phoneNumber4); Assert.True(phoneNumber1 != phoneNumber4); - + // change country var phoneNumber5 = new GeographicPhoneNumber(PhoneNumberHint.None) { Country = CountryInfo.France, - GeographicArea = "N/A", - NationalDestinationCode = null, - NationalSignificantNumber = "12345667788", - SubscriberNumber = "667788", + GeographicArea = phoneNumber1.GeographicArea, + NationalDestinationCode = phoneNumber1.NationalDestinationCode, + NationalSignificantNumber = phoneNumber1.NationalSignificantNumber, + SubscriberNumber = phoneNumber1.SubscriberNumber, }; + + Assert.NotEqual(phoneNumber1, phoneNumber5); + Assert.False(phoneNumber1.Equals(phoneNumber5)); + Assert.False(phoneNumber1 == phoneNumber5); + Assert.True(phoneNumber1 != phoneNumber5); } } diff --git a/test/PhoneNumbers.Tests/MobilePhoneNumberTests.cs b/test/PhoneNumbers.Tests/MobilePhoneNumberTests.cs index 9e7e1bd6..e1b0ec9b 100644 --- a/test/PhoneNumbers.Tests/MobilePhoneNumberTests.cs +++ b/test/PhoneNumbers.Tests/MobilePhoneNumberTests.cs @@ -157,5 +157,19 @@ public void Inequality() Assert.False(phoneNumber1.Equals(phoneNumber4)); Assert.False(phoneNumber1 == phoneNumber4); Assert.True(phoneNumber1 != phoneNumber4); + + // change country + var phoneNumber5 = new MobilePhoneNumber(PhoneNumberHint.None) + { + Country = CountryInfo.France, + NationalDestinationCode = phoneNumber1.NationalDestinationCode, + NationalSignificantNumber = phoneNumber1.NationalSignificantNumber, + SubscriberNumber = phoneNumber1.SubscriberNumber, + }; + + Assert.NotEqual(phoneNumber1, phoneNumber5); + Assert.False(phoneNumber1.Equals(phoneNumber5)); + Assert.False(phoneNumber1 == phoneNumber5); + Assert.True(phoneNumber1 != phoneNumber5); } } diff --git a/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs b/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs index 95efbf95..3737d3ea 100644 --- a/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs +++ b/test/PhoneNumbers.Tests/NonGeographicPhoneNumberTests.cs @@ -209,5 +209,19 @@ public void Inequality() Assert.False(phoneNumber1.Equals(phoneNumber4)); Assert.False(phoneNumber1 == phoneNumber4); Assert.True(phoneNumber1 != phoneNumber4); + + // change country + var phoneNumber5 = new NonGeographicPhoneNumber(PhoneNumberHint.None) + { + Country = CountryInfo.France, + NationalDestinationCode = phoneNumber1.NationalDestinationCode, + NationalSignificantNumber = phoneNumber1.NationalSignificantNumber, + SubscriberNumber = phoneNumber1.SubscriberNumber, + }; + + Assert.NotEqual(phoneNumber1, phoneNumber5); + Assert.False(phoneNumber1.Equals(phoneNumber5)); + Assert.False(phoneNumber1 == phoneNumber5); + Assert.True(phoneNumber1 != phoneNumber5); } }