• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RefList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



RefList类属于命名空间,在下文中一共展示了RefList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: setUp

 protected void setUp()
 {
     packed = RefList<global::GitSharp.Core.Ref>.emptyList();
     loose = RefList<global::GitSharp.Core.Ref>.emptyList();
     resolved = RefList<global::GitSharp.Core.Ref>.emptyList();
 }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:6,代码来源:RefMapTest.cs


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: TestPut_WithPrefix

		public virtual void TestPut_WithPrefix()
		{
			Ref refA_one = NewRef("refs/heads/A", ID_ONE);
			Ref refA_two = NewRef("refs/heads/A", ID_TWO);
			packed = ToList(refA_one);
			RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
			NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
			NUnit.Framework.Assert.AreSame(refA_one, map.Put("A", refA_two));
			// map changed, but packed, loose did not
			NUnit.Framework.Assert.AreSame(refA_two, map.Get("A"));
			NUnit.Framework.Assert.AreSame(refA_one, packed.Get(0));
			NUnit.Framework.Assert.AreEqual(0, loose.Size());
			NUnit.Framework.Assert.AreSame(refA_two, map.Put("A", refA_one));
			NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
		}
开发者ID:shoff,项目名称:ngit,代码行数:15,代码来源:RefMapTest.cs


示例18: TestMerge_WithPrefix

		public virtual void TestMerge_WithPrefix()
		{
			Ref a = NewRef("refs/heads/A", ID_ONE);
			Ref b = NewRef("refs/heads/foo/bar/B", ID_TWO);
			Ref c = NewRef("refs/heads/foo/rab/C", ID_TWO);
			Ref g = NewRef("refs/heads/g", ID_ONE);
			packed = ToList(a, b, c, g);
			RefMap map = new RefMap("refs/heads/foo/", packed, loose, resolved);
			NUnit.Framework.Assert.AreEqual(2, map.Count);
			NUnit.Framework.Assert.AreSame(b, map.Get("bar/B"));
			NUnit.Framework.Assert.AreSame(c, map.Get("rab/C"));
			NUnit.Framework.Assert.IsNull(map.Get("refs/heads/foo/bar/B"));
			NUnit.Framework.Assert.IsNull(map.Get("refs/heads/A"));
			NUnit.Framework.Assert.IsTrue(map.ContainsKey("bar/B"));
			NUnit.Framework.Assert.IsTrue(map.ContainsKey("rab/C"));
			NUnit.Framework.Assert.IsFalse(map.ContainsKey("refs/heads/foo/bar/B"));
			NUnit.Framework.Assert.IsFalse(map.ContainsKey("refs/heads/A"));
			Iterator<KeyValuePair<string, Ref>> itr = map.EntrySet().Iterator();
			KeyValuePair<string, Ref> ent;
			NUnit.Framework.Assert.IsTrue(itr.HasNext());
			ent = itr.Next();
			NUnit.Framework.Assert.AreEqual("bar/B", ent.Key);
			NUnit.Framework.Assert.AreSame(b, ent.Value);
			NUnit.Framework.Assert.IsTrue(itr.HasNext());
			ent = itr.Next();
			NUnit.Framework.Assert.AreEqual("rab/C", ent.Key);
			NUnit.Framework.Assert.AreSame(c, ent.Value);
			NUnit.Framework.Assert.IsFalse(itr.HasNext());
		}
开发者ID:shoff,项目名称:ngit,代码行数:29,代码来源:RefMapTest.cs


示例19: testIterator_RefusesRemove

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

            RefMap map = new RefMap("", packed, loose, resolved);
            IteratorBase<global::GitSharp.Core.Ref> itr = map.values().iterator();
            Assert.IsTrue(itr.hasNext());
            Assert.AreSame(master, itr.next());
            try
            {
                itr.remove();
                Assert.Fail("iterator allowed remove");
            }
            catch (NotSupportedException err)
            {
                // expected
            }
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:19,代码来源:RefMapTest.cs


示例20: TestEntryTypeSet

		public virtual void TestEntryTypeSet()
		{
			Ref refA_one = NewRef("refs/heads/A", ID_ONE);
			Ref refA_two = NewRef("refs/heads/A", ID_TWO);
			packed = ToList(refA_one);
			RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
			NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
			KeyValuePair<string, Ref> ent = map.EntrySet().Iterator().Next();
			NUnit.Framework.Assert.AreEqual("A", ent.Key);
			NUnit.Framework.Assert.AreSame(refA_one, ent.Value);
//			NUnit.Framework.Assert.AreSame(refA_one, ent.SetValue(refA_two));
//			NUnit.Framework.Assert.AreSame(refA_two, ent.Value);
			NUnit.Framework.Assert.AreSame(refA_two, map.Get("A"));
			NUnit.Framework.Assert.AreEqual(1, map.Count);
		}
开发者ID:shoff,项目名称:ngit,代码行数:15,代码来源:RefMapTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RefMap类代码示例发布时间:2022-05-24
下一篇:
C# RefKind类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap