コード例 #1
0
        public virtual void TestNoCacheObjectIdSubclass()
        {
            string    newRef = "refs/heads/abc";
            RefUpdate ru     = UpdateRef(newRef);

            RefUpdateTest.SubclassedId newid = new RefUpdateTest.SubclassedId(ru.GetNewObjectId
                                                                                  ());
            ru.SetNewObjectId(newid);
            RefUpdate.Result update = ru.Update();
            NUnit.Framework.Assert.AreEqual(RefUpdate.Result.NEW, update);
            Ref r = db.GetAllRefs().Get(newRef);

            NUnit.Framework.Assert.IsNotNull(r);
            NUnit.Framework.Assert.AreEqual(newRef, r.GetName());
            NUnit.Framework.Assert.IsNotNull(r.GetObjectId());
            NUnit.Framework.Assert.AreNotSame(newid, r.GetObjectId());
            NUnit.Framework.Assert.AreSame(typeof(ObjectId), r.GetObjectId().GetType());
            NUnit.Framework.Assert.AreEqual(newid, r.GetObjectId());
            IList <ReflogEntry> reverseEntries1 = db.GetReflogReader("refs/heads/abc").GetReverseEntries
                                                      ();
            ReflogEntry entry1 = reverseEntries1[0];

            NUnit.Framework.Assert.AreEqual(1, reverseEntries1.Count);
            NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, entry1.GetOldId());
            NUnit.Framework.Assert.AreEqual(r.GetObjectId(), entry1.GetNewId());
            NUnit.Framework.Assert.AreEqual(new PersonIdent(db).ToString(), entry1.GetWho().ToString
                                                ());
            NUnit.Framework.Assert.AreEqual(string.Empty, entry1.GetComment());
            IList <ReflogEntry> reverseEntries2 = db.GetReflogReader("HEAD").GetReverseEntries
                                                      ();

            NUnit.Framework.Assert.AreEqual(0, reverseEntries2.Count);
        }
コード例 #2
0
ファイル: RefUpdateTest.cs プロジェクト: LunarLanding/ngit
		public virtual void TestNoCacheObjectIdSubclass()
		{
			string newRef = "refs/heads/abc";
			RefUpdate ru = UpdateRef(newRef);
			RefUpdateTest.SubclassedId newid = new RefUpdateTest.SubclassedId(ru.GetNewObjectId
				());
			ru.SetNewObjectId(newid);
			RefUpdate.Result update = ru.Update();
			NUnit.Framework.Assert.AreEqual(RefUpdate.Result.NEW, update);
			Ref r = db.GetAllRefs().Get(newRef);
			NUnit.Framework.Assert.IsNotNull(r);
			NUnit.Framework.Assert.AreEqual(newRef, r.GetName());
			NUnit.Framework.Assert.IsNotNull(r.GetObjectId());
			NUnit.Framework.Assert.AreNotSame(newid, r.GetObjectId());
			NUnit.Framework.Assert.AreSame(typeof(ObjectId), r.GetObjectId().GetType());
			NUnit.Framework.Assert.AreEqual(newid, r.GetObjectId());
			IList<ReflogEntry> reverseEntries1 = db.GetReflogReader("refs/heads/abc").GetReverseEntries
				();
			ReflogEntry entry1 = reverseEntries1[0];
			NUnit.Framework.Assert.AreEqual(1, reverseEntries1.Count);
			NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, entry1.GetOldId());
			NUnit.Framework.Assert.AreEqual(r.GetObjectId(), entry1.GetNewId());
			NUnit.Framework.Assert.AreEqual(new PersonIdent(db).ToString(), entry1.GetWho().ToString
				());
			NUnit.Framework.Assert.AreEqual(string.Empty, entry1.GetComment());
			IList<ReflogEntry> reverseEntries2 = db.GetReflogReader("HEAD").GetReverseEntries
				();
			NUnit.Framework.Assert.AreEqual(0, reverseEntries2.Count);
		}