Ejemplo n.º 1
0
        public void TestConfigReader()
        {
            var configReader = new ConfigReader(_tempDir + _mainTestConfigFilename);

            var secondValue = configReader.GetAppSetting("secondKey");
            Assert.AreEqual("secondValue", secondValue);
        }
Ejemplo n.º 2
0
        private OperationResult IsMatch(List<string> paths, string key, string expectedValue,
            Func<ConfigReader, string> chosenFunction)
        {
            OperationResult result = new OperationResult();

            if (!paths.Any())
            {
                paths = new List<string>() { "" };
            }

            foreach (string path in paths)
            {
                ConfigReader configReader = new ConfigReader(path);
                string foundValue = chosenFunction(configReader);

                if (String.IsNullOrEmpty(foundValue) || foundValue != expectedValue)
                {
                    result.Successful &= false;
                    result.Description += String.Format("Mismatch in file '{0}' on '{1}'. ",
                        path,
                        key);
                }
            }

            return result;
        }