public void GetHashCodeReturnsCorrectResult( double total) { var d = (decimal)total; var sut = new Vat(d); var actual = sut.GetHashCode(); var expected = d.GetHashCode(); Assert.Equal(expected, actual); }
/// <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 (Title != null) { hashCode = hashCode * 59 + Title.GetHashCode(); } if (Items != null) { hashCode = hashCode * 59 + Items.GetHashCode(); } if (Facts != null) { hashCode = hashCode * 59 + Facts.GetHashCode(); } if (Tap != null) { hashCode = hashCode * 59 + Tap.GetHashCode(); } if (Total != null) { hashCode = hashCode * 59 + Total.GetHashCode(); } if (Tax != null) { hashCode = hashCode * 59 + Tax.GetHashCode(); } if (Vat != null) { hashCode = hashCode * 59 + Vat.GetHashCode(); } if (Buttons != null) { hashCode = hashCode * 59 + Buttons.GetHashCode(); } return(hashCode); } }