Ejemplo n.º 1
0
        public void CanSaveMultipleValuesForSameKeyInSections()
        {
            // create test data
            {
                ConfigFile configFile = new ConfigFile(GetConfigFileName());

                configFile.AddValue("remote.origin.fetch", "+mypath");
                configFile.AddValue("remote.origin.fetch", "+myotherpath");

                configFile.Save();
            }

            // verify
            {

                ConfigFile configFile = new ConfigFile(GetConfigFileName());

                IList<string> values = configFile.GetValues("remote.origin.fetch");

                Assert.IsTrue(values.SingleOrDefault(x => x == "+mypath") != null);
                Assert.IsTrue(values.SingleOrDefault(x => x == "+myotherpath") != null);
            }
        }
Ejemplo n.º 2
0
        public void CaseSensitive()
        {
            // create test data
            {
                ConfigFile configFile = new ConfigFile(GetConfigFileName(), true);
                configFile.AddValue("branch.BranchName1.remote", "origin1");
                configFile.Save();

                AddConfigValue(GetConfigFileName(), "branch.\"BranchName2\".remote", "origin2");
                AddConfigValue(GetConfigFileName(), "branch.\"branchName2\".remote", "origin3");
            }
            // verify
            {

                ConfigFile configFile = new ConfigFile(GetConfigFileName(), true);

                string remote = "branch.BranchName1.remote";
                Assert.AreEqual("origin1", configFile.GetValue(remote), remote);

                remote = "branch.branchName1.remote";
                Assert.AreEqual("origin1", configFile.GetValue(remote), remote);

                remote = "branch \"branchName1\".remote";
                Assert.AreNotEqual("origin1", configFile.GetValue(remote), remote);

                remote = "branch \"BranchName2\".remote";
                Assert.AreEqual("origin2", configFile.GetValue(remote), remote);

                remote = "branch \"branchName2\".remote";
                Assert.AreNotEqual("origin2", configFile.GetValue(remote), remote);

                remote = "branch \"branchName2\".remote";
                Assert.AreEqual("origin3", configFile.GetValue(remote), remote);

                remote = "branch \"branchname2\".remote";
                Assert.AreEqual("", configFile.GetValue(remote), remote);

            }
        }