Exemple #1
0
        public void SimpleGetHashCode()
        {
            // [true]
            int expected = "CHF".GetHashCode() + 14;

            Assert.AreEqual(expected, f14CHF.GetHashCode());
        }
Exemple #2
0
        public void Hashes()
        {
            Cash chf  = new Cash(6, "CHF");
            Cash chf2 = new Cash(3, "CHF");

            Assert.AreEqual(chf.GetHashCode(), chf2.Multiply(2).GetHashCode());
        }
Exemple #3
0
 public override int GetHashCode()
 {
     // credit: http://stackoverflow.com/a/263416/677735
     unchecked // Overflow is fine, just wrap
     {
         int hash = 41;
         // Suitable nullity checks etc, of course :)
         if (Currency != null)
         {
             hash = hash * 59 + Currency.GetHashCode();
         }
         hash = hash * 59 + Cash.GetHashCode();
         hash = hash * 59 + Equity.GetHashCode();
         hash = hash * 59 + Profit.GetHashCode();
         hash = hash * 59 + DayProfit.GetHashCode();
         return(hash);
     }
 }
Exemple #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Cash != 0)
            {
                hash ^= Cash.GetHashCode();
            }
            if (PropertyWorth != 0)
            {
                hash ^= PropertyWorth.GetHashCode();
            }
            if (Total != 0)
            {
                hash ^= Total.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }