public void HashCodeCheck() { ChemicalFormula formulaA = new ChemicalFormula("Al"); ChemicalFormula formulaB = new ChemicalFormula("Al{27}"); Assert.AreNotEqual(formulaA.GetHashCode(), formulaB.GetHashCode()); }
public void HashCodeEquality() { ChemicalFormula formulaA = new ChemicalFormula("C2H3NO"); ChemicalFormula formulaB = new ChemicalFormula("H3C2NO"); Assert.AreEqual(formulaA.GetHashCode(), formulaB.GetHashCode()); }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (PeptideModifiedSequence != null ? PeptideModifiedSequence.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MoleculeName != null ? MoleculeName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ChemicalFormula != null ? ChemicalFormula.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (InChiKey != null ? InChiKey.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OtherKeys != null ? OtherKeys.GetHashCode() : 0); return(hashCode); } }
public void HashCodeImmutableEquality() { ChemicalFormula formulaA = new ChemicalFormula("C2H3NO"); Assert.AreEqual(formulaA.GetHashCode(), formulaA.GetHashCode()); }
public override int GetHashCode() { return(base.GetHashCode() ^ chemicalFormula.GetHashCode()); }