/// <summary>
        /// Returns true if PhysicalAddress instances are equal
        /// </summary>
        /// <param name="other">Instance of PhysicalAddress to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PhysicalAddress other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CountryId == other.CountryId ||
                     CountryId != null &&
                     CountryId.Equals(other.CountryId)
                     ) &&
                 (
                     Zip == other.Zip ||
                     Zip != null &&
                     Zip.Equals(other.Zip)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     AdministrativeArea == other.AdministrativeArea ||
                     AdministrativeArea != null &&
                     AdministrativeArea.Equals(other.AdministrativeArea)
                 ) &&
                 (
                     DependentLocality == other.DependentLocality ||
                     DependentLocality != null &&
                     DependentLocality.Equals(other.DependentLocality)
                 ) &&
                 (
                     SortingCode == other.SortingCode ||
                     SortingCode != null &&
                     SortingCode.Equals(other.SortingCode)
                 ) &&
                 (
                     Organization == other.Organization ||
                     Organization != null &&
                     Organization.Equals(other.Organization)
                 ) &&
                 (
                     AddressLine1 == other.AddressLine1 ||
                     AddressLine1 != null &&
                     AddressLine1.Equals(other.AddressLine1)
                 ) &&
                 (
                     AddressLine2 == other.AddressLine2 ||
                     AddressLine2 != null &&
                     AddressLine2.Equals(other.AddressLine2)
                 ));
        }
Beispiel #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (CountryId != null)
         {
             hashCode = hashCode * 59 + CountryId.GetHashCode();
         }
         if (Zip != null)
         {
             hashCode = hashCode * 59 + Zip.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (AdministrativeArea != null)
         {
             hashCode = hashCode * 59 + AdministrativeArea.GetHashCode();
         }
         if (DependentLocality != null)
         {
             hashCode = hashCode * 59 + DependentLocality.GetHashCode();
         }
         if (SortingCode != null)
         {
             hashCode = hashCode * 59 + SortingCode.GetHashCode();
         }
         if (Organization != null)
         {
             hashCode = hashCode * 59 + Organization.GetHashCode();
         }
         if (AddressLine1 != null)
         {
             hashCode = hashCode * 59 + AddressLine1.GetHashCode();
         }
         if (AddressLine2 != null)
         {
             hashCode = hashCode * 59 + AddressLine2.GetHashCode();
         }
         if (IsPrimary != null)
         {
             hashCode = hashCode * 59 + IsPrimary.GetHashCode();
         }
         if (SessionToken != null)
         {
             hashCode = hashCode * 59 + SessionToken.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #3
0
        public void AdministrativeArea_Name_Constructor()
        {
            // Arrange
            var name = "name";

            // Act
            var administrativeArea = new AdministrativeArea(name);

            // Assert
            administrativeArea.Name.Should().Be(name);
        }
Beispiel #4
0
        public void AdministrativeArea_Default_Constructor()
        {
            // Arrange
            // Act
            var administrativeArea = new AdministrativeArea();

            // Assert
            administrativeArea.Name.Should().BeNull();
            administrativeArea.Abbreviation.Should().BeNull();
            administrativeArea.BoundaryType.Should().BeNull();
            administrativeArea.GroupName.Should().BeNull();
        }
Beispiel #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Revision != 0)
            {
                hash ^= Revision.GetHashCode();
            }
            if (RegionCode.Length != 0)
            {
                hash ^= RegionCode.GetHashCode();
            }
            if (LanguageCode.Length != 0)
            {
                hash ^= LanguageCode.GetHashCode();
            }
            if (PostalCode.Length != 0)
            {
                hash ^= PostalCode.GetHashCode();
            }
            if (SortingCode.Length != 0)
            {
                hash ^= SortingCode.GetHashCode();
            }
            if (AdministrativeArea.Length != 0)
            {
                hash ^= AdministrativeArea.GetHashCode();
            }
            if (Locality.Length != 0)
            {
                hash ^= Locality.GetHashCode();
            }
            if (Sublocality.Length != 0)
            {
                hash ^= Sublocality.GetHashCode();
            }
            hash ^= addressLines_.GetHashCode();
            hash ^= recipients_.GetHashCode();
            if (Organization.Length != 0)
            {
                hash ^= Organization.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            if (!(obj is AddressData addressData))
            {
                return(false);
            }

            return((PostalCountry == null
                    ? addressData.PostalCountry == null
                    : PostalCountry.Equals(addressData.PostalCountry)) &&
                   (!AddressLines.Any()
                    ? !addressData.AddressLines.Any()
                    : AddressLines.Equals(addressData.AddressLines)) &&
                   (AdministrativeArea == null
                    ? addressData.AdministrativeArea == null
                    : AdministrativeArea.Equals(addressData.AdministrativeArea)) &&
                   (Locality == null
                    ? addressData.Locality == null
                    : Locality.Equals(addressData.Locality)) &&
                   (DependentLocality == null
                    ? addressData.DependentLocality == null
                    : DependentLocality.Equals(addressData.DependentLocality)) &&
                   (PostalCode == null
                    ? addressData.PostalCode == null
                    : PostalCode.Equals(addressData.PostalCode)) &&
                   (SortingCode == null
                    ? addressData.SortingCode == null
                    : SortingCode.Equals(addressData.SortingCode)) &&
                   (Organization == null
                    ? addressData.Organization == null
                    : Organization.Equals(addressData.Organization)) &&
                   (Recipient == null
                    ? addressData.Recipient == null
                    : Recipient.Equals(addressData.Recipient)) &&
                   (LanguageCode == null
                    ? addressData.LanguageCode == null
                    : LanguageCode.Equals(addressData.LanguageCode)));
        }
 /// <summary>
 /// Area as an AdministrativeArea.
 /// </summary>
 /// <param name="area">Area as an AdministrativeArea.</param>
 public Area(AdministrativeArea area) : base(area.Name.AsText)
 {
     AsAdministrativeArea = area;
 }
Beispiel #8
0
        /// <summary>
        /// Returns true if AddressesModel2 instances are equal
        /// </summary>
        /// <param name="other">Instance of AddressesModel2 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AddressesModel2 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AddressId == other.AddressId ||
                     AddressId != null &&
                     AddressId.Equals(other.AddressId)
                     ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     CountryId == other.CountryId ||
                     CountryId != null &&
                     CountryId.Equals(other.CountryId)
                 ) &&
                 (
                     Zip == other.Zip ||
                     Zip != null &&
                     Zip.Equals(other.Zip)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     AdministrativeArea == other.AdministrativeArea ||
                     AdministrativeArea != null &&
                     AdministrativeArea.Equals(other.AdministrativeArea)
                 ) &&
                 (
                     DependentLocality == other.DependentLocality ||
                     DependentLocality != null &&
                     DependentLocality.Equals(other.DependentLocality)
                 ) &&
                 (
                     SortingCode == other.SortingCode ||
                     SortingCode != null &&
                     SortingCode.Equals(other.SortingCode)
                 ) &&
                 (
                     Organization == other.Organization ||
                     Organization != null &&
                     Organization.Equals(other.Organization)
                 ) &&
                 (
                     AddressLine1 == other.AddressLine1 ||
                     AddressLine1 != null &&
                     AddressLine1.Equals(other.AddressLine1)
                 ) &&
                 (
                     AddressLine2 == other.AddressLine2 ||
                     AddressLine2 != null &&
                     AddressLine2.Equals(other.AddressLine2)
                 ) &&
                 (
                     IsPrimary == other.IsPrimary ||
                     IsPrimary != null &&
                     IsPrimary.Equals(other.IsPrimary)
                 ) &&
                 (
                     SessionToken == other.SessionToken ||
                     SessionToken != null &&
                     SessionToken.Equals(other.SessionToken)
                 ));
        }