public void testReadBoolean_OnOff2() { global::GitSharp.Core.Config c = parse("[s]\na = ON\nb = OFF\n"); Assert.AreEqual("ON", c.getString("s", null, "a")); Assert.AreEqual("OFF", c.getString("s", null, "b")); Assert.IsTrue(c.getBoolean("s", "a", false)); Assert.IsFalse(c.getBoolean("s", "b", true)); }
public void testReadBoolean_YesNo2() { global::GitSharp.Core.Config c = parse("[s]\na = yEs\nb = NO\n"); Assert.AreEqual("yEs", c.getString("s", null, "a")); Assert.AreEqual("NO", c.getString("s", null, "b")); Assert.IsTrue(c.getBoolean("s", "a", false)); Assert.IsFalse(c.getBoolean("s", "b", true)); }
public void testReadBoolean_TrueFalse2() { global::GitSharp.Core.Config c = parse("[s]\na = TrUe\nb = fAlSe\n"); Assert.AreEqual("TrUe", c.getString("s", null, "a")); Assert.AreEqual("fAlSe", c.getString("s", null, "b")); Assert.IsTrue(c.getBoolean("s", "a", false)); Assert.IsFalse(c.getBoolean("s", "b", true)); }
public void test002_ReadWithSubsection() { global::GitSharp.Core.Config c = parse("[foo \"zip\"]\nbar\n[foo \"zap\"]\nbar=false\nn=3\n"); Assert.AreEqual(true, c.getBoolean("foo", "zip", "bar", false)); Assert.AreEqual(string.Empty, c.getString("foo", "zip", "bar")); Assert.AreEqual(false, c.getBoolean("foo", "zap", "bar", true)); Assert.AreEqual("false", c.getString("foo", "zap", "bar")); Assert.AreEqual(3, c.getInt("foo", "zap", "n", 4)); Assert.AreEqual(4, c.getInt("foo", "zap", "m", 4)); }
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()); }
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()); }
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()); }
public void test001_ReadBareKey() { global::GitSharp.Core.Config c = parse("[foo]\nbar\n"); Assert.AreEqual(true, c.getBoolean("foo", null, "bar", false)); Assert.AreEqual(string.Empty, c.getString("foo", null, "bar")); }
public void test006_readCaseInsensitive() { global::GitSharp.Core.Config c = parse("[Foo]\nBar\n"); Assert.AreEqual(true, c.getBoolean("foo", null, "bar", false)); Assert.AreEqual(string.Empty, c.getString("foo", null, "bar")); }