public void HashCode() { var spec1 = new VersionSpec { MinVersion = new SemanticVersion("1.0"), MaxVersion = new SemanticVersion("2.0") }; var spec2 = new VersionSpec { MinVersion = new SemanticVersion("1.0"), MaxVersion = new SemanticVersion("2.0") }; Assert.Equal(spec1.GetHashCode(), spec2.GetHashCode()); }
public override int GetHashCode() { unchecked { var hashCode = (PackageNode != null ? PackageNode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (VersionSpec != null ? VersionSpec.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(Name) : 0); return(hashCode); } }