当前位置: 首页>>代码示例>>C#>>正文


C# RefList类代码示例

本文整理汇总了C#中RefList的典型用法代码示例。如果您正苦于以下问题:C# RefList类的具体用法?C# RefList怎么用?C# RefList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RefList类属于命名空间,在下文中一共展示了RefList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testEmptyBuilder

        public void testEmptyBuilder()
        {
            RefList<global::GitSharp.Core.Ref> list = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>().toRefList();
            Assert.AreEqual(0, list.size());
            Assert.IsFalse(list.iterator().hasNext());
            Assert.AreEqual(-1, list.find("a"));
            Assert.AreEqual(-1, list.find("z"));
            Assert.IsFalse(list.contains("a"));
            Assert.IsNull(list.get("a"));
            Assert.IsTrue(list.asList().Count == 0);
            Assert.AreEqual("[]", list.ToString());

            // default array capacity should be 16, with no bounds checking.
            Assert.IsNull(list.get(16 - 1));
            try
            {
                list.get(16);
                Assert.Fail("default RefList should have 16 element array");
            }
            catch (IndexOutOfRangeException)
            {
                // expected
            }
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:24,代码来源:RefListTest.cs

示例2: toList

 private RefList<global::GitSharp.Core.Ref> toList(params global::GitSharp.Core.Ref[] refs)
 {
     var b = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>(refs.Length);
     b.addAll(refs, 0, refs.Length);
     return b.toRefList();
 }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:6,代码来源:RefMapTest.cs

示例3: SetUp

		public virtual void SetUp()
		{
			packed = RefList.EmptyList();
			loose = RefList.EmptyList();
			resolved = RefList.EmptyList();
		}
开发者ID:shoff,项目名称:ngit,代码行数:6,代码来源:RefMapTest.cs

示例4: testClear

        public void testClear()
        {
            global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
            loose = toList(master);

            RefMap map = new RefMap("", packed, loose, resolved);
            Assert.AreSame(master, map.get("refs/heads/master"));

            map.clear();
            Assert.IsNull(map.get("refs/heads/master"));
            Assert.IsTrue(map.isEmpty());
            Assert.AreEqual(0, map.size());
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:13,代码来源:RefMapTest.cs

示例5: testIterator_MissingUnresolvedSymbolicRefIsBug

        public void testIterator_MissingUnresolvedSymbolicRefIsBug()
        {
            global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
            global::GitSharp.Core.Ref headR = newRef("HEAD", master);

            loose = toList(master);
            // loose should have added newRef("HEAD", "refs/heads/master")
            resolved = toList(headR);

            var map = new RefMap("", packed, loose, resolved);
            IteratorBase<global::GitSharp.Core.Ref> itr = map.values().iterator();

            try
            {
                itr.hasNext();
                Assert.Fail("iterator did not catch bad input");
            }
            catch (InvalidOperationException err)
            {
                // expected
            }
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:22,代码来源:RefMapTest.cs

示例6: TestMerge_PackedLooseLoose

		public virtual void TestMerge_PackedLooseLoose()
		{
			Ref refA = NewRef("A", ID_ONE);
			Ref refB_ONE = NewRef("B", ID_ONE);
			Ref refB_TWO = NewRef("B", ID_TWO);
			Ref refc = NewRef("c", ID_ONE);
			packed = ToList(refA, refB_ONE);
			loose = ToList(refB_TWO, refc);
			RefMap map = new RefMap(string.Empty, packed, loose, resolved);
			NUnit.Framework.Assert.AreEqual(3, map.Count);
			NUnit.Framework.Assert.IsFalse(map.IsEmpty());
			NUnit.Framework.Assert.IsTrue(map.ContainsKey(refA.GetName()));
			NUnit.Framework.Assert.AreSame(refA, map.Get(refA.GetName()));
			// loose overrides packed given same name
			NUnit.Framework.Assert.AreSame(refB_TWO, map.Get(refB_ONE.GetName()));
			Iterator<Ref> itr = map.Values.Iterator();
			NUnit.Framework.Assert.IsTrue(itr.HasNext());
			NUnit.Framework.Assert.AreSame(refA, itr.Next());
			NUnit.Framework.Assert.IsTrue(itr.HasNext());
			NUnit.Framework.Assert.AreSame(refB_TWO, itr.Next());
			NUnit.Framework.Assert.IsTrue(itr.HasNext());
			NUnit.Framework.Assert.AreSame(refc, itr.Next());
			NUnit.Framework.Assert.IsFalse(itr.HasNext());
		}
开发者ID:shoff,项目名称:ngit,代码行数:24,代码来源:RefMapTest.cs

示例7: testPut_WithPrefix

        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"));
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:19,代码来源:RefMapTest.cs

示例8: testToString_WithPrefix

        public void testToString_WithPrefix()
        {
            global::GitSharp.Core.Ref a = newRef("refs/heads/A", ID_ONE);
            global::GitSharp.Core.Ref b = newRef("refs/heads/foo/B", ID_TWO);
            global::GitSharp.Core.Ref c = newRef("refs/heads/foo/C", ID_TWO);
            global::GitSharp.Core.Ref g = newRef("refs/heads/g", ID_ONE);

            packed = toList(a, b, c, g);

            StringBuilder exp = new StringBuilder();
            exp.Append("[");
            exp.Append(b.ToString());
            exp.Append(", ");
            exp.Append(c.ToString());
            exp.Append("]");

            RefMap map = new RefMap("refs/heads/foo/", packed, loose, resolved);
            Assert.AreEqual(exp.ToString(), map.ToString());
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:19,代码来源:RefMapTest.cs

示例9: testMerge_PackedLooseLoose

        public void testMerge_PackedLooseLoose()
        {
            global::GitSharp.Core.Ref refA = newRef("A", ID_ONE);
            global::GitSharp.Core.Ref refB_ONE = newRef("B", ID_ONE);
            global::GitSharp.Core.Ref refB_TWO = newRef("B", ID_TWO);
            global::GitSharp.Core.Ref refc = newRef("c", ID_ONE);

            packed = toList(refA, refB_ONE);
            loose = toList(refB_TWO, refc);

            RefMap map = new RefMap("", packed, loose, resolved);
            Assert.AreEqual(3, map.size());
            Assert.IsFalse(map.isEmpty());
            Assert.IsTrue(map.containsKey(refA.Name));
            Assert.AreSame(refA, map.get(refA.Name));

            // loose overrides packed given same name
            Assert.AreSame(refB_TWO, map.get(refB_ONE.Name));

            var itr = map.values().iterator();
            Assert.IsTrue(itr.hasNext());
            Assert.AreSame(refA, itr.next());
            Assert.IsTrue(itr.hasNext());
            Assert.AreSame(refB_TWO, itr.next());
            Assert.IsTrue(itr.hasNext());
            Assert.AreSame(refc, itr.next());
            Assert.IsFalse(itr.hasNext());
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:28,代码来源:RefMapTest.cs

示例10: testNotEmpty_WithPrefix

        public void testNotEmpty_WithPrefix()
        {
            global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
            packed = toList(master);

            RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
            Assert.IsFalse(map.isEmpty()); // before size was computed
            Assert.AreEqual(1, map.size());
            Assert.IsFalse(map.isEmpty()); // after size was computed
            Assert.AreSame(master, map.values().iterator().next());
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:11,代码来源:RefMapTest.cs

示例11: TestToString_WithPrefix

		public virtual void TestToString_WithPrefix()
		{
			Ref a = NewRef("refs/heads/A", ID_ONE);
			Ref b = NewRef("refs/heads/foo/B", ID_TWO);
			Ref c = NewRef("refs/heads/foo/C", ID_TWO);
			Ref g = NewRef("refs/heads/g", ID_ONE);
			packed = ToList(a, b, c, g);
			StringBuilder exp = new StringBuilder();
			exp.Append("[");
			exp.Append(b.ToString());
			exp.Append(", ");
			exp.Append(c.ToString());
			exp.Append("]");
			RefMap map = new RefMap("refs/heads/foo/", packed, loose, resolved);
			NUnit.Framework.Assert.AreEqual(exp.ToString(), map.ToString());
		}
开发者ID:shoff,项目名称:ngit,代码行数:16,代码来源:RefMapTest.cs

示例12: TestEntryType

		public virtual void TestEntryType()
		{
			Ref a = NewRef("refs/heads/A", ID_ONE);
			Ref b = NewRef("refs/heads/B", ID_TWO);
			packed = ToList(a, b);
			RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
			Iterator<KeyValuePair<string, Ref>> itr = map.EntrySet().Iterator();
			KeyValuePair<string, Ref> ent_a = itr.Next();
			KeyValuePair<string, Ref> ent_b = itr.Next();
//			NUnit.Framework.Assert.AreEqual(ent_a.GetHashCode(), "A".GetHashCode());
			NUnit.Framework.Assert.IsTrue(ent_a.Equals(ent_a));
			NUnit.Framework.Assert.IsFalse(ent_a.Equals(ent_b));
			NUnit.Framework.Assert.AreEqual(a.ToString(), ent_a.ToString());
		}
开发者ID:shoff,项目名称:ngit,代码行数:14,代码来源:RefMapTest.cs

示例13: TestRemove

		public virtual void TestRemove()
		{
			Ref master = NewRef("refs/heads/master", ID_ONE);
			Ref headU = NewRef("HEAD", "refs/heads/master");
			Ref headR = NewRef("HEAD", master);
			packed = ToList(master);
			loose = ToList(headU, master);
			resolved = ToList(headR);
			RefMap map = new RefMap(string.Empty, packed, loose, resolved);
			NUnit.Framework.Assert.IsNull(Sharpen.Collections.Remove(map, "not.a.reference"));
			NUnit.Framework.Assert.AreSame(master, Sharpen.Collections.Remove(map, "refs/heads/master"
				));
			NUnit.Framework.Assert.IsNull(map.Get("refs/heads/master"));
			NUnit.Framework.Assert.AreSame(headR, Sharpen.Collections.Remove(map, "HEAD"));
			NUnit.Framework.Assert.IsNull(map.Get("HEAD"));
			NUnit.Framework.Assert.IsTrue(map.IsEmpty());
		}
开发者ID:shoff,项目名称:ngit,代码行数:17,代码来源:RefMapTest.cs

示例14: TestToString_NoPrefix

		public virtual void TestToString_NoPrefix()
		{
			Ref a = NewRef("refs/heads/A", ID_ONE);
			Ref b = NewRef("refs/heads/B", ID_TWO);
			packed = ToList(a, b);
			StringBuilder exp = new StringBuilder();
			exp.Append("[");
			exp.Append(a.ToString());
			exp.Append(", ");
			exp.Append(b.ToString());
			exp.Append("]");
			RefMap map = new RefMap(string.Empty, packed, loose, resolved);
			NUnit.Framework.Assert.AreEqual(exp.ToString(), map.ToString());
		}
开发者ID:shoff,项目名称:ngit,代码行数:14,代码来源:RefMapTest.cs

示例15: TestPut_CollapseResolved

		public virtual void TestPut_CollapseResolved()
		{
			Ref master = NewRef("refs/heads/master", ID_ONE);
			Ref headU = NewRef("HEAD", "refs/heads/master");
			Ref headR = NewRef("HEAD", master);
			Ref a = NewRef("refs/heads/A", ID_ONE);
			loose = ToList(headU, master);
			resolved = ToList(headR);
			RefMap map = new RefMap(string.Empty, packed, loose, resolved);
			NUnit.Framework.Assert.IsNull(map.Put(a.GetName(), a));
			NUnit.Framework.Assert.AreSame(a, map.Get(a.GetName()));
			NUnit.Framework.Assert.AreSame(headR, map.Get("HEAD"));
		}
开发者ID:shoff,项目名称:ngit,代码行数:13,代码来源:RefMapTest.cs


注:本文中的RefList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。