Example #1
0
 public void testBooleanWithNoValue()
 {
     global::GitSharp.Core.Config c = parse("[my]\n\tempty\n");
     Assert.AreEqual("", c.getString("my", null, "empty"));
     Assert.AreEqual(1, c.getStringList("my", null, "empty").Length);
     Assert.AreEqual("", c.getStringList("my", null, "empty")[0]);
     Assert.IsTrue(c.getBoolean("my", "empty", false));
     Assert.AreEqual("[my]\n\tempty\n", c.toText());
 }
Example #2
0
        public void test005_PutGetStringList()
        {
            global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
            List <string> values           = new List <string>();

            values.Add("value1");
            values.Add("value2");
            c.setStringList("my", null, "somename", values);

            object[] expArr = values.ToArray();
            string[] actArr = c.getStringList("my", null, "somename");
            Assert.IsTrue(expArr.SequenceEqual(actArr));

            string expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";

            Assert.AreEqual(expText, c.toText());
        }
Example #3
0
        public void testEmptyString()
        {
            global::GitSharp.Core.Config c = parse("[my]\n\tempty =\n");
            Assert.IsNull(c.getString("my", null, "empty"));

            String[] values = c.getStringList("my", null, "empty");
            Assert.IsNotNull(values);
            Assert.AreEqual(1, values.Length);
            Assert.IsNull(values[0]);

            // always matches the default, because its non-boolean
            Assert.IsTrue(c.getBoolean("my", "empty", true));
            Assert.IsFalse(c.getBoolean("my", "empty", false));

            Assert.AreEqual("[my]\n\tempty =\n", c.toText());

            c = new global::GitSharp.Core.Config();
            c.setStringList("my", null, "empty", values.ToList());
            Assert.AreEqual("[my]\n\tempty =\n", c.toText());
        }
Example #4
0
        public void test005_PutGetStringList()
        {
            global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
            List<string> values = new List<string>();
            values.Add("value1");
            values.Add("value2");
            c.setStringList("my", null, "somename", values);

            object[] expArr = values.ToArray();
            string[] actArr = c.getStringList("my", null, "somename");
            Assert.IsTrue(expArr.SequenceEqual(actArr));

            string expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
            Assert.AreEqual(expText, c.toText());
        }