示例#1
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 (CustomerId != null)
         {
             hashCode = hashCode * 59 + CustomerId.GetHashCode();
         }
         if (ExpiryMonth != null)
         {
             hashCode = hashCode * 59 + ExpiryMonth.GetHashCode();
         }
         if (ExpiryYear != null)
         {
             hashCode = hashCode * 59 + ExpiryYear.GetHashCode();
         }
         if (BillingDetails != null)
         {
             hashCode = hashCode * 59 + BillingDetails.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Last4 != null)
         {
             hashCode = hashCode * 59 + Last4.GetHashCode();
         }
         if (PaymentMethod != null)
         {
             hashCode = hashCode * 59 + PaymentMethod.GetHashCode();
         }
         if (Fingerprint != null)
         {
             hashCode = hashCode * 59 + Fingerprint.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (CvvCheck != null)
         {
             hashCode = hashCode * 59 + CvvCheck.GetHashCode();
         }
         if (AvsCheck != null)
         {
             hashCode = hashCode * 59 + AvsCheck.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#2
0
        /// <summary>
        /// Returns true if Card instances are equal
        /// </summary>
        /// <param name="other">Instance of Card to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CardSource other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CustomerId == other.CustomerId ||
                     CustomerId != null &&
                     CustomerId.Equals(other.CustomerId)
                     ) &&
                 (
                     ExpiryMonth == other.ExpiryMonth ||
                     ExpiryMonth != null &&
                     ExpiryMonth.Equals(other.ExpiryMonth)
                 ) &&
                 (
                     ExpiryYear == other.ExpiryYear ||
                     ExpiryYear != null &&
                     ExpiryYear.Equals(other.ExpiryYear)
                 ) &&
                 (
                     BillingDetails == other.BillingDetails ||
                     BillingDetails != null &&
                     BillingDetails.Equals(other.BillingDetails)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Last4 == other.Last4 ||
                     Last4 != null &&
                     Last4.Equals(other.Last4)
                 ) &&
                 (
                     PaymentMethod == other.PaymentMethod ||
                     PaymentMethod != null &&
                     PaymentMethod.Equals(other.PaymentMethod)
                 ) &&
                 (
                     Fingerprint == other.Fingerprint ||
                     Fingerprint != null &&
                     Fingerprint.Equals(other.Fingerprint)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     CvvCheck == other.CvvCheck ||
                     CvvCheck != null &&
                     CvvCheck.Equals(other.CvvCheck)
                 ) &&
                 (
                     AvsCheck == other.AvsCheck ||
                     AvsCheck != null &&
                     AvsCheck.Equals(other.AvsCheck)
                 ));
        }