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


C# RefList.get方法代码示例

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


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

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

示例2: 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 err)
            {
                // expected
            }
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:24,代码来源:RefListTest.cs

示例3: testBuilder_Set

        public void testBuilder_Set()
        {
            var builder = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>();
            builder.add(REF_A);
            builder.add(REF_A);

            Assert.AreEqual(2, builder.size());
            Assert.AreSame(REF_A, builder.get(0));
            Assert.AreSame(REF_A, builder.get(1));

            RefList<global::GitSharp.Core.Ref> list = builder.toRefList();
            Assert.AreEqual(2, list.size());
            Assert.AreSame(REF_A, list.get(0));
            Assert.AreSame(REF_A, list.get(1));
            builder.set(1, REF_B);

            list = builder.toRefList();
            Assert.AreEqual(2, list.size());
            Assert.AreSame(REF_A, list.get(0));
            Assert.AreSame(REF_B, list.get(1));
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:21,代码来源:RefListTest.cs

示例4: testCopyConstructorReusesArray

        public void testCopyConstructorReusesArray()
        {
            var one = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>();
            one.add(REF_A);

            var two = new RefList<global::GitSharp.Core.Ref>(one.toRefList());
            one.set(0, REF_B);
            Assert.AreSame(REF_B, two.get(0));
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:9,代码来源:RefListTest.cs

示例5: testBuilder_Remove

        public void testBuilder_Remove()
        {
            var builder = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>();
            builder.add(REF_A);
            builder.add(REF_B);
            builder.remove(0);

            Assert.AreEqual(1, builder.size());
            Assert.AreSame(REF_B, builder.get(0));
        }
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:10,代码来源:RefListTest.cs


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