public void GetHashCodeTest(bool junk, string[] toppings1) { var t1 = new Toppings(toppings1); var hashCode = (toppings1 != null ? string.Join(", ", toppings1) : string.Empty).GetHashCode(); Assert.AreEqual(hashCode, t1.GetHashCode()); }
public override int GetHashCode() { unchecked { var hashCode = Id.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ BasePrice.GetHashCode(); hashCode = (hashCode * 397) ^ (Toppings != null ? Toppings.GetHashCode() : 0); return(hashCode); } }