Esempio n. 1
0
        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
            }
        }
Esempio n. 2
0
        public void testToString()
        {
            var exp = new StringBuilder();

            exp.Append("[");
            exp.Append(REF_A);
            exp.Append(", ");
            exp.Append(REF_B);
            exp.Append("]");

            RefList <global::GitSharp.Core.Ref> list = toList(REF_A, REF_B);

            Assert.AreEqual(exp.ToString(), list.ToString());
        }
Esempio n. 3
0
        public void testBuilder_ToString()
        {
            var exp = new StringBuilder();

            exp.Append("[");
            exp.Append(REF_A);
            exp.Append(", ");
            exp.Append(REF_B);
            exp.Append("]");

            var list = new RefList <global::GitSharp.Core.Ref> .Builder <global::GitSharp.Core.Ref>();

            list.add(REF_A);
            list.add(REF_B);
            Assert.AreEqual(exp.ToString(), list.ToString());
        }
Esempio n. 4
0
        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
            }
        }
Esempio n. 5
0
        public void testBuilder_ToString()
        {
            var exp = new StringBuilder();
            exp.Append("[");
            exp.Append(REF_A);
            exp.Append(", ");
            exp.Append(REF_B);
            exp.Append("]");

            var list = new RefList<global::GitSharp.Core.Ref>.Builder<global::GitSharp.Core.Ref>();
            list.add(REF_A);
            list.add(REF_B);
            Assert.AreEqual(exp.ToString(), list.ToString());
        }