public override int GetHashCode() { unchecked { return((_currencyPair.GetHashCode() * 397) ^ _side.GetHashCode()); } }
public void GetHashCode_TwoDifferentCurrencyPairs_AreNotEqual() { var pair1 = new CurrencyPair("BTC", "USD"); var pair2 = new CurrencyPair("ETH", "USD"); Assert.NotEqual(pair1.GetHashCode(), pair2.GetHashCode()); }
public void GetHashCode_TwoIdenticalCurrencyPairs_AreEqual() { var pair1 = new CurrencyPair("BTC", "USD"); var pair2 = new CurrencyPair("BTC", "USD"); Assert.Equal(pair1.GetHashCode(), pair2.GetHashCode()); }
public override int GetHashCode() { unchecked { return(((CurrencyPair != null ? CurrencyPair.GetHashCode() : 0) * 397) ^ Timestamp.GetHashCode()); } }
/// <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 (CallsVolume != null) { hashCode = hashCode * 59 + CallsVolume.GetHashCode(); } if (PutsVolume != null) { hashCode = hashCode * 59 + PutsVolume.GetHashCode(); } hashCode = hashCode * 59 + CurrencyPair.GetHashCode(); if (FuturesVolume != null) { hashCode = hashCode * 59 + FuturesVolume.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return(CurrencyPair.GetHashCode()); }