예제 #1
0
 public void test004_PutGetSimple()
 {
     global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
     c.setString("my", null, "somename", "false");
     Assert.AreEqual("false", c.getString("my", null, "somename"));
     Assert.AreEqual("[my]\n\tsomename = false\n", c.toText());
 }
예제 #2
0
 public void test003_PutRemote()
 {
     global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
     c.setString("sec", "ext", "name", "value");
     c.setString("sec", "ext", "name2", "value2");
     string expText = "[sec \"ext\"]\n\tname = value\n\tname2 = value2\n";
     Assert.AreEqual(expText, c.toText());
 }
예제 #3
0
        public void test003_PutRemote()
        {
            global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
            c.setString("sec", "ext", "name", "value");
            c.setString("sec", "ext", "name2", "value2");
            string expText = "[sec \"ext\"]\n\tname = value\n\tname2 = value2\n";

            Assert.AreEqual(expText, c.toText());
        }
예제 #4
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());
 }
예제 #5
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());
        }
예제 #6
0
 public void testUnsetSingleSection()
 {
     global::GitSharp.Core.Config c = parse("" //
                                            + "[branch \"keep\"]\n"
                                            + "  merge = master.branch.to.keep.in.the.file\n"
                                            + "\n"
                                            + "[single]\n"
                                            + "  merge = this.will.get.deleted\n"
                                            + "  remote = origin-for-some-long-gone-place\n"
                                            + "\n"
                                            + "[core-section-not-to-remove-in-test]\n"
                                            + "  packedGitLimit = 14\n");
     c.unsetSection("single", null);
     Assert.AreEqual("" //
                     + "[branch \"keep\"]\n"
                     + "  merge = master.branch.to.keep.in.the.file\n"
                     + "\n"
                     + "[core-section-not-to-remove-in-test]\n"
                     + "  packedGitLimit = 14\n", c.toText());
 }
예제 #7
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());
        }
예제 #8
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());
        }
예제 #9
0
 public void test004_PutGetSimple()
 {
     global::GitSharp.Core.Config c = new global::GitSharp.Core.Config();
     c.setString("my", null, "somename", "false");
     Assert.AreEqual("false", c.getString("my", null, "somename"));
     Assert.AreEqual("[my]\n\tsomename = false\n", c.toText());
 }
예제 #10
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());
        }