Esempio n. 1
0
        public void HashCodeTests()
        {
            JObject o1 = new JObject
            {
                ["prop"] = 1
            };
            JObject o2 = new JObject
            {
                ["prop"] = 1
            };

            Assert.IsFalse(ReferenceEquals(o1, o2));
            Assert.IsFalse(Equals(o1, o2));
            Assert.IsFalse(o1.GetHashCode() == o2.GetHashCode());
            Assert.IsTrue(o1.GetDeepHashCode() == o2.GetDeepHashCode());
            Assert.IsTrue(JToken.DeepEquals(o1, o2));

            JArray a1 = new JArray
            {
                1
            };
            JArray a2 = new JArray
            {
                1
            };

            Assert.IsFalse(ReferenceEquals(a1, a2));
            Assert.IsFalse(Equals(a1, a2));
            Assert.IsFalse(a1.GetHashCode() == a2.GetHashCode());
            Assert.IsTrue(a1.GetDeepHashCode() == a2.GetDeepHashCode());
            Assert.IsTrue(JToken.DeepEquals(a1, a2));
        }