示例#1
0
        public void testPutNewEntry()
        {
            RefList <global::GitSharp.Core.Ref> one = toList(REF_A, REF_c);
            RefList <global::GitSharp.Core.Ref> two = one.put(REF_B);

            Assert.AreNotSame(one, two);

            // one is not modified, but two is
            Assert.AreEqual(2, one.size());
            Assert.AreSame(REF_A, one.get(0));
            Assert.AreSame(REF_c, one.get(1));

            Assert.AreEqual(3, two.size());
            Assert.AreSame(REF_A, two.get(0));
            Assert.AreSame(REF_B, two.get(1));
            Assert.AreSame(REF_c, two.get(2));
        }
示例#2
0
        public void testPutReplaceEntry()
        {
            global::GitSharp.Core.Ref otherc = newRef(REF_c.Name);
            Assert.AreNotSame(REF_c, otherc);

            RefList <global::GitSharp.Core.Ref> one = toList(REF_A, REF_c);
            RefList <global::GitSharp.Core.Ref> two = one.put(otherc);

            Assert.AreNotSame(one, two);

            // one is not modified, but two is
            Assert.AreEqual(2, one.size());
            Assert.AreSame(REF_A, one.get(0));
            Assert.AreSame(REF_c, one.get(1));

            Assert.AreEqual(2, two.size());
            Assert.AreSame(REF_A, two.get(0));
            Assert.AreSame(otherc, two.get(1));
        }