예제 #1
0
        public virtual void TestEquals()
        {
            RevCommit a1 = Commit();
            RevCommit b1 = Commit();

            NUnit.Framework.Assert.IsTrue(a1.Equals(a1));
            NUnit.Framework.Assert.IsTrue(a1.Equals((object)a1));
            NUnit.Framework.Assert.IsFalse(a1.Equals(b1));
            NUnit.Framework.Assert.IsTrue(a1.Equals(a1));
            NUnit.Framework.Assert.IsTrue(a1.Equals((object)a1));
            NUnit.Framework.Assert.IsFalse(a1.Equals(string.Empty));
            RevWalk   rw2 = new RevWalk(db);
            RevCommit a2  = rw2.ParseCommit(a1);
            RevCommit b2  = rw2.ParseCommit(b1);

            NUnit.Framework.Assert.AreNotSame(a1, a2);
            NUnit.Framework.Assert.AreNotSame(b1, b2);
            NUnit.Framework.Assert.IsTrue(a1.Equals(a2));
            NUnit.Framework.Assert.IsTrue(b1.Equals(b2));
            NUnit.Framework.Assert.AreEqual(a1.GetHashCode(), a2.GetHashCode());
            NUnit.Framework.Assert.AreEqual(b1.GetHashCode(), b2.GetHashCode());
            NUnit.Framework.Assert.IsTrue(AnyObjectId.Equals(a1, a2));
            NUnit.Framework.Assert.IsTrue(AnyObjectId.Equals(b1, b2));
        }