public override int GetHashCode() { unchecked { var hashCode = HashConstants.OffsetBasis; hashCode = (hashCode ^ (FeatureModel.GetHashCode())) * HashConstants.Prime; foreach (var gene in Genes.OrderBy(g => g.FeatureId)) { hashCode = (hashCode ^ (gene.GetHashCode())) * HashConstants.Prime; } return(hashCode); } }
public void GetHashCode_ReturnsSame_ForReversedFeaturesFeatureModel() { var identicalFeatureModel = new FeatureModel(_features.Reverse().ToArray(), _relations.Reverse().ToArray()); Assert.AreEqual(_featureModel.GetHashCode(), identicalFeatureModel.GetHashCode()); }