Пример #1
0
        public void testEqualsIsIdentity()
        {
            RevCommit a1 = Commit();
            RevCommit b1 = Commit();

            Assert.IsTrue(a1.Equals(a1));
            Assert.IsTrue(a1.Equals((object)a1));
            Assert.IsFalse(a1.Equals(b1));

            Assert.IsFalse(a1.Equals(a1.Copy()));
            Assert.IsFalse(a1.Equals((object)a1.Copy()));
            Assert.IsFalse(a1.Equals(string.Empty));

            var       rw2 = new GitSharp.Core.RevWalk.RevWalk(db);
            RevCommit a2  = rw2.parseCommit(a1);
            RevCommit b2  = rw2.parseCommit(b1);

            Assert.AreNotSame(a1, a2);
            Assert.AreNotSame(b1, b2);

            Assert.IsFalse(a1.Equals(a2));
            Assert.IsFalse(b1.Equals(b2));

            Assert.AreEqual(a1.GetHashCode(), a2.GetHashCode());
            Assert.AreEqual(b1.GetHashCode(), b2.GetHashCode());

            Assert.IsTrue(AnyObjectId.equals(a1, a2));
            Assert.IsTrue(AnyObjectId.equals(b1, b2));
        }