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

            return
                ((
                     CardWithoutCvv == other.CardWithoutCvv ||
                     CardWithoutCvv != null &&
                     CardWithoutCvv.Equals(other.CardWithoutCvv)
                     ) &&
                 (
                     FirstTransactionDate == other.FirstTransactionDate ||
                     FirstTransactionDate != null &&
                     FirstTransactionDate.Equals(other.FirstTransactionDate)
                 ) &&
                 (
                     ProviderReference == other.ProviderReference ||
                     ProviderReference != null &&
                     ProviderReference.Equals(other.ProviderReference)
                 ));
        }
Esempio n. 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 (CardWithoutCvv != null)
         {
             hashCode = hashCode * 59 + CardWithoutCvv.GetHashCode();
         }
         if (FirstTransactionDate != null)
         {
             hashCode = hashCode * 59 + FirstTransactionDate.GetHashCode();
         }
         if (ProviderReference != null)
         {
             hashCode = hashCode * 59 + ProviderReference.GetHashCode();
         }
         return(hashCode);
     }
 }