コード例 #1
0
ファイル: RefMapTest.cs プロジェクト: zzia615/GitSharp
        public void testPut_WithPrefix()
        {
            global::GitSharp.Core.Ref refA_one = newRef("refs/heads/A", ID_ONE);
            global::GitSharp.Core.Ref refA_two = newRef("refs/heads/A", ID_TWO);

            packed = toList(refA_one);

            RefMap map = new RefMap("refs/heads/", packed, loose, resolved);

            Assert.AreSame(refA_one, map.get("A"));
            Assert.AreSame(refA_one, map.put("A", refA_two));

            // map changed, but packed, loose did not
            Assert.AreSame(refA_two, map.get("A"));
            Assert.AreSame(refA_one, packed.get(0));
            Assert.AreEqual(0, loose.size());

            Assert.AreSame(refA_two, map.put("A", refA_one));
            Assert.AreSame(refA_one, map.get("A"));
        }
コード例 #2
0
ファイル: RefMapTest.cs プロジェクト: zzia615/GitSharp
        public void testPut_KeyMustMatchName_WithPrefix()
        {
            global::GitSharp.Core.Ref refA = newRef("refs/heads/A", ID_ONE);
            RefMap map = new RefMap("refs/heads/", packed, loose, resolved);

            try
            {
                map.put("FOO", refA);
                Assert.Fail("map accepted invalid key/value pair");
            }
            catch (ArgumentException)
            {
                // expected
            }
        }
コード例 #3
0
ファイル: RefMapTest.cs プロジェクト: zzia615/GitSharp
        public void testPut_CollapseResolved()
        {
            global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
            global::GitSharp.Core.Ref headU  = newRef("HEAD", "refs/heads/master");
            global::GitSharp.Core.Ref headR  = newRef("HEAD", master);
            global::GitSharp.Core.Ref a      = newRef("refs/heads/A", ID_ONE);

            loose    = toList(headU, master);
            resolved = toList(headR);

            RefMap map = new RefMap("", packed, loose, resolved);

            Assert.IsNull(map.put(a.getName(), a));
            Assert.AreSame(a, map.get(a.getName()));
            Assert.AreSame(headR, map.get("HEAD"));
        }
コード例 #4
0
ファイル: RefMapTest.cs プロジェクト: deodelacruz/GitSharp
        public void testPut_WithPrefix()
        {
            global::GitSharp.Core.Ref refA_one = newRef("refs/heads/A", ID_ONE);
            global::GitSharp.Core.Ref refA_two = newRef("refs/heads/A", ID_TWO);

            packed = toList(refA_one);

            RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
            Assert.AreSame(refA_one, map.get("A"));
            Assert.AreSame(refA_one, map.put("A", refA_two));

            // map changed, but packed, loose did not
            Assert.AreSame(refA_two, map.get("A"));
            Assert.AreSame(refA_one, packed.get(0));
            Assert.AreEqual(0, loose.size());

            Assert.AreSame(refA_two, map.put("A", refA_one));
            Assert.AreSame(refA_one, map.get("A"));
        }
コード例 #5
0
ファイル: RefMapTest.cs プロジェクト: deodelacruz/GitSharp
 public void testPut_KeyMustMatchName_WithPrefix()
 {
     global::GitSharp.Core.Ref refA = newRef("refs/heads/A", ID_ONE);
     RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
     try
     {
         map.put("FOO", refA);
         Assert.Fail("map accepted invalid key/value pair");
     }
     catch (ArgumentException err)
     {
         // expected
     }
 }
コード例 #6
0
ファイル: RefMapTest.cs プロジェクト: deodelacruz/GitSharp
        public void testPut_CollapseResolved()
        {
            global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
            global::GitSharp.Core.Ref headU = newRef("HEAD", "refs/heads/master");
            global::GitSharp.Core.Ref headR = newRef("HEAD", master);
            global::GitSharp.Core.Ref a = newRef("refs/heads/A", ID_ONE);

            loose = toList(headU, master);
            resolved = toList(headR);

            RefMap map = new RefMap("", packed, loose, resolved);
            Assert.IsNull(map.put(a.getName(), a));
            Assert.AreSame(a, map.get(a.getName()));
            Assert.AreSame(headR, map.get("HEAD"));
        }