public void EqualsTest1()
    {
        const string uriStr = "http://folkers-website.de";
        var          id1    = new PropertyID(7);
        var          id2    = new PropertyID(7, new PropertyIDMapping(5, new Uri(uriStr)));
        var          id3    = new PropertyID(7, new PropertyIDMapping(5, new Uri(uriStr)));
        var          id4    = new PropertyID(5, new PropertyIDMapping(5, new Uri(uriStr)));
        var          id5    = new PropertyID(7, new PropertyIDMapping(5, new Uri("http://other-website")));
        var          id6    = new PropertyID(5);

        Assert.AreNotEqual(id1, id2);
        Assert.AreNotEqual(id1.GetHashCode(), id2.GetHashCode());

        Assert.AreEqual(id2, id2);

        Assert.AreEqual(id2, id3);
        Assert.AreEqual(id2.GetHashCode(), id3.GetHashCode());

        Assert.AreNotEqual(id3, id4);
        Assert.AreNotEqual(id3.GetHashCode(), id4.GetHashCode());

        Assert.AreEqual(id3, id5);
        Assert.AreEqual(id3.GetHashCode(), id5.GetHashCode());

        Assert.AreNotEqual(id1, id6);
        Assert.AreNotEqual(id1.GetHashCode(), id6.GetHashCode());
    }
Exemple #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Path.Length != 0)
            {
                hash ^= Path.GetHashCode();
            }
            if (PropertyID != 0UL)
            {
                hash ^= PropertyID.GetHashCode();
            }
            if (PropertyType.Length != 0)
            {
                hash ^= PropertyType.GetHashCode();
            }
            if (PropertyValue.Length != 0)
            {
                hash ^= PropertyValue.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #3
0
 public override int GetHashCode()
 {
     return(wPropId.GetHashCode());
 }