示例#1
0
        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());
        }
示例#2
0
 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);
     }
 }
示例#3
0
        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());
        }