Ejemplo n.º 1
0
        public void testConstructor()
        {
            global::GitSharp.Core.Ref t;
            SymbolicRef r;

            t = new Unpeeled(Storage.New, targetName, null);
            r = new SymbolicRef(name, t);
            Assert.AreSame(Storage.Loose, r.getStorage());
            Assert.AreSame(name, r.getName());
            Assert.IsNull(r.getObjectId(), "no id on new ref");
            Assert.IsFalse(r.isPeeled(), "not peeled");
            Assert.IsNull(r.getPeeledObjectId(), "no peel id");
            Assert.AreSame(t, r.getLeaf(), "leaf is t");
            Assert.AreSame(t, r.getTarget(), "target is t");
            Assert.IsTrue(r.isSymbolic(), "is symbolic");

            t = new Unpeeled(Storage.Packed, targetName, ID_A);
            r = new SymbolicRef(name, t);
            Assert.AreSame(Storage.Loose, r.getStorage());
            Assert.AreSame(name, r.getName());
            Assert.AreSame(ID_A, r.getObjectId());
            Assert.IsFalse(r.isPeeled(), "not peeled");
            Assert.IsNull(r.getPeeledObjectId(), "no peel id");
            Assert.AreSame(t, r.getLeaf(), "leaf is t");
            Assert.AreSame(t, r.getTarget(), "target is t");
            Assert.IsTrue(r.isSymbolic(), "is symbolic");
        }
Ejemplo n.º 2
0
        public void testLeaf()
        {
            global::GitSharp.Core.Ref a;
            SymbolicRef b, c, d;

            a = new PeeledTag(Storage.Packed, targetName, ID_A, ID_B);
            b = new SymbolicRef("B", a);
            c = new SymbolicRef("C", b);
            d = new SymbolicRef("D", c);

            Assert.AreSame(c, d.getTarget());
            Assert.AreSame(b, c.getTarget());
            Assert.AreSame(a, b.getTarget());

            Assert.AreSame(a, d.getLeaf());
            Assert.AreSame(a, c.getLeaf());
            Assert.AreSame(a, b.getLeaf());
            Assert.AreSame(a, a.getLeaf());

            Assert.AreSame(ID_A, d.getObjectId());
            Assert.AreSame(ID_A, c.getObjectId());
            Assert.AreSame(ID_A, b.getObjectId());

            Assert.IsTrue(d.isPeeled());
            Assert.IsTrue(c.isPeeled());
            Assert.IsTrue(b.isPeeled());

            Assert.AreSame(ID_B, d.getPeeledObjectId());
            Assert.AreSame(ID_B, c.getPeeledObjectId());
            Assert.AreSame(ID_B, b.getPeeledObjectId());
        }
Ejemplo n.º 3
0
        public void testToString()
        {
            global::GitSharp.Core.Ref a;
            SymbolicRef b, c, d;

            a = new PeeledTag(Storage.Packed, targetName, ID_A, ID_B);
            b = new SymbolicRef("B", a);
            c = new SymbolicRef("C", b);
            d = new SymbolicRef("D", c);

            Assert.AreEqual("SymbolicRef[D -> C -> B -> " + targetName + "="
                            + ID_A.Name + "]", d.ToString());
        }