コード例 #1
0
        public virtual void TestLeaf()
        {
            Ref         a;
            SymbolicRef b;
            SymbolicRef c;
            SymbolicRef d;

            a = new ObjectIdRef.PeeledTag(RefStorage.PACKED, targetName, ID_A, ID_B);
            b = new SymbolicRef("B", a);
            c = new SymbolicRef("C", b);
            d = new SymbolicRef("D", c);
            NUnit.Framework.Assert.AreSame(c, d.GetTarget());
            NUnit.Framework.Assert.AreSame(b, c.GetTarget());
            NUnit.Framework.Assert.AreSame(a, b.GetTarget());
            NUnit.Framework.Assert.AreSame(a, d.GetLeaf());
            NUnit.Framework.Assert.AreSame(a, c.GetLeaf());
            NUnit.Framework.Assert.AreSame(a, b.GetLeaf());
            NUnit.Framework.Assert.AreSame(a, a.GetLeaf());
            NUnit.Framework.Assert.AreSame(ID_A, d.GetObjectId());
            NUnit.Framework.Assert.AreSame(ID_A, c.GetObjectId());
            NUnit.Framework.Assert.AreSame(ID_A, b.GetObjectId());
            NUnit.Framework.Assert.IsTrue(d.IsPeeled());
            NUnit.Framework.Assert.IsTrue(c.IsPeeled());
            NUnit.Framework.Assert.IsTrue(b.IsPeeled());
            NUnit.Framework.Assert.AreSame(ID_B, d.GetPeeledObjectId());
            NUnit.Framework.Assert.AreSame(ID_B, c.GetPeeledObjectId());
            NUnit.Framework.Assert.AreSame(ID_B, b.GetPeeledObjectId());
        }
コード例 #2
0
        public virtual void TestConstructor()
        {
            Ref         t;
            SymbolicRef r;

            t = new ObjectIdRef.Unpeeled(RefStorage.NEW, targetName, null);
            r = new SymbolicRef(name, t);
            NUnit.Framework.Assert.AreEqual(RefStorage.LOOSE, r.GetStorage());
            NUnit.Framework.Assert.AreSame(name, r.GetName());
            NUnit.Framework.Assert.IsNull(r.GetObjectId(), "no id on new ref");
            NUnit.Framework.Assert.IsFalse(r.IsPeeled(), "not peeled");
            NUnit.Framework.Assert.IsNull(r.GetPeeledObjectId(), "no peel id");
            NUnit.Framework.Assert.AreSame(t, r.GetLeaf(), "leaf is t");
            NUnit.Framework.Assert.AreSame(t, r.GetTarget(), "target is t");
            NUnit.Framework.Assert.IsTrue(r.IsSymbolic(), "is symbolic");
            t = new ObjectIdRef.Unpeeled(RefStorage.PACKED, targetName, ID_A);
            r = new SymbolicRef(name, t);
            NUnit.Framework.Assert.AreEqual(RefStorage.LOOSE, r.GetStorage());
            NUnit.Framework.Assert.AreSame(name, r.GetName());
            NUnit.Framework.Assert.AreSame(ID_A, r.GetObjectId());
            NUnit.Framework.Assert.IsFalse(r.IsPeeled(), "not peeled");
            NUnit.Framework.Assert.IsNull(r.GetPeeledObjectId(), "no peel id");
            NUnit.Framework.Assert.AreSame(t, r.GetLeaf(), "leaf is t");
            NUnit.Framework.Assert.AreSame(t, r.GetTarget(), "target is t");
            NUnit.Framework.Assert.IsTrue(r.IsSymbolic(), "is symbolic");
        }
コード例 #3
0
ファイル: SymbolicRefTest.cs プロジェクト: LunarLanding/ngit
		public virtual void TestConstructor()
		{
			Ref t;
			SymbolicRef r;
			t = new ObjectIdRef.Unpeeled(RefStorage.NEW, targetName, null);
			r = new SymbolicRef(name, t);
			NUnit.Framework.Assert.AreEqual(RefStorage.LOOSE, r.GetStorage());
			NUnit.Framework.Assert.AreSame(name, r.GetName());
			NUnit.Framework.Assert.IsNull(r.GetObjectId(), "no id on new ref");
			NUnit.Framework.Assert.IsFalse(r.IsPeeled(), "not peeled");
			NUnit.Framework.Assert.IsNull(r.GetPeeledObjectId(), "no peel id");
			NUnit.Framework.Assert.AreSame(t, r.GetLeaf(), "leaf is t");
			NUnit.Framework.Assert.AreSame(t, r.GetTarget(), "target is t");
			NUnit.Framework.Assert.IsTrue(r.IsSymbolic(), "is symbolic");
			t = new ObjectIdRef.Unpeeled(RefStorage.PACKED, targetName, ID_A);
			r = new SymbolicRef(name, t);
			NUnit.Framework.Assert.AreEqual(RefStorage.LOOSE, r.GetStorage());
			NUnit.Framework.Assert.AreSame(name, r.GetName());
			NUnit.Framework.Assert.AreSame(ID_A, r.GetObjectId());
			NUnit.Framework.Assert.IsFalse(r.IsPeeled(), "not peeled");
			NUnit.Framework.Assert.IsNull(r.GetPeeledObjectId(), "no peel id");
			NUnit.Framework.Assert.AreSame(t, r.GetLeaf(), "leaf is t");
			NUnit.Framework.Assert.AreSame(t, r.GetTarget(), "target is t");
			NUnit.Framework.Assert.IsTrue(r.IsSymbolic(), "is symbolic");
		}
コード例 #4
0
ファイル: SymbolicRefTest.cs プロジェクト: LunarLanding/ngit
		public virtual void TestLeaf()
		{
			Ref a;
			SymbolicRef b;
			SymbolicRef c;
			SymbolicRef d;
			a = new ObjectIdRef.PeeledTag(RefStorage.PACKED, targetName, ID_A, ID_B);
			b = new SymbolicRef("B", a);
			c = new SymbolicRef("C", b);
			d = new SymbolicRef("D", c);
			NUnit.Framework.Assert.AreSame(c, d.GetTarget());
			NUnit.Framework.Assert.AreSame(b, c.GetTarget());
			NUnit.Framework.Assert.AreSame(a, b.GetTarget());
			NUnit.Framework.Assert.AreSame(a, d.GetLeaf());
			NUnit.Framework.Assert.AreSame(a, c.GetLeaf());
			NUnit.Framework.Assert.AreSame(a, b.GetLeaf());
			NUnit.Framework.Assert.AreSame(a, a.GetLeaf());
			NUnit.Framework.Assert.AreSame(ID_A, d.GetObjectId());
			NUnit.Framework.Assert.AreSame(ID_A, c.GetObjectId());
			NUnit.Framework.Assert.AreSame(ID_A, b.GetObjectId());
			NUnit.Framework.Assert.IsTrue(d.IsPeeled());
			NUnit.Framework.Assert.IsTrue(c.IsPeeled());
			NUnit.Framework.Assert.IsTrue(b.IsPeeled());
			NUnit.Framework.Assert.AreSame(ID_B, d.GetPeeledObjectId());
			NUnit.Framework.Assert.AreSame(ID_B, c.GetPeeledObjectId());
			NUnit.Framework.Assert.AreSame(ID_B, b.GetPeeledObjectId());
		}