Ejemplo n.º 1
0
 public void TestFileReader()
 {
     var tr = new FeatureSettingsFileReader(new SettingsToolConfiguration {
         XmlSettingsDirectory = dir
     });
     var dict = tr.ReadXmlFiles();
 }
Ejemplo n.º 2
0
        public void TestSaveChangesToXmlFile()
        {
            var xmlTestFile = "Module_Settings.xml";
            var config      = new SettingsToolConfiguration {
                XmlSettingsDirectory = dir
            };
            var tr   = new FeatureSettingsFileReader(config);
            var dict = tr.ReadXmlFiles();
            var rep  = new FeatureSettingsFileRepository(dict.Where(x => x.Key.Contains(xmlTestFile)).Select(y => y).ToDictionary(a => a.Key, b => b.Value));

            rep.Initialize();
            var coc = rep.GetConfigOrSettingsContentFromString(xmlTestFile);
            var xe  = coc.SaveChangesToXDocument();
            //xe.Save(Path.Combine(dir, String.Concat(Path.GetFileNameWithoutExtension(xmlTestFile), " (Copy).xml"));
        }
Ejemplo n.º 3
0
        public void TestDEZA_INT_ModuleRevisions_Xml()
        {
            var xmlTestFile = "DEZA_INT_ModuleRevisions_04.03.002.xml";
            var config      = new SettingsToolConfiguration {
                XmlSettingsDirectory = dir
            };
            var tr   = new FeatureSettingsFileReader(config);
            var dict = tr.ReadXmlFiles();
            var rep  = new FeatureSettingsFileRepository(dict.Where(x => x.Key.Contains(xmlTestFile)).Select(y => y).ToDictionary(a => a.Key, b => b.Value));

            rep.Initialize();

            var sfs = rep.SearchForSubfolders(xmlTestFile, "MainModule");

            Assert.IsTrue(sfs.Count == 1 && sfs[0].NoOfItems == 4);
        }
Ejemplo n.º 4
0
        public void TestReadBaseConfig_Xml()
        {
            var xmlTestFile = "BaseConfig.xml";
            var config      = new SettingsToolConfiguration {
                XmlSettingsDirectory = dir
            };
            var tr   = new FeatureSettingsFileReader(config);
            var dict = tr.ReadXmlFiles();
            var rep  = new FeatureSettingsFileRepository(dict.Where(x => x.Key.Contains(xmlTestFile)).Select(y => y).ToDictionary(a => a.Key, b => b.Value));

            rep.Initialize();

            var sfs = rep.SearchForSubfolders(xmlTestFile, "MMServer");

            Assert.IsTrue(sfs.Count == 1 && sfs[0].Attributes.Count == 2);
            sfs = rep.SearchForSubfolders(xmlTestFile, "MiniModule");
            Assert.IsTrue(sfs.Count == 28);
        }
Ejemplo n.º 5
0
        public void TestRepository()
        {
            var xmlTestFile = "Module_Settings.xml";
            var config      = new SettingsToolConfiguration {
                XmlSettingsDirectory = dir
            };
            var tr   = new FeatureSettingsFileReader(config);
            var dict = tr.ReadXmlFiles();
            var rep  = new FeatureSettingsFileRepository(dict.Where(x => x.Key.Contains(xmlTestFile)).Select(y => y).ToDictionary(a => a.Key, b => b.Value));

            rep.Initialize();
            var xes          = dict[xmlTestFile].Descendants(XmlConstants._item);
            var noItems      = xes.Count();
            var noSubfolder  = xes.Select(x => x.Parent).Distinct().Count();
            var coc          = rep.GetConfigOrSettingsContentFromString(xmlTestFile);
            var noItems1     = coc.NoOfItems();
            var noSubfolder1 = coc.NoOfItemSubfolders();

            Assert.AreEqual(noItems, noItems1);
            // Git Test XXX
            Assert.AreEqual(noSubfolder, noSubfolder1);
        }
Ejemplo n.º 6
0
        public void TestModule_Server_Access_XML()
        {
            var xmlTestFile = "Module_Server_Access.xml";
            var config      = new SettingsToolConfiguration {
                XmlSettingsDirectory = dir
            };
            var tr   = new FeatureSettingsFileReader(config);
            var dict = tr.ReadXmlFiles();
            var rep  = new FeatureSettingsFileRepository(dict.Where(x => x.Key.Contains(xmlTestFile)).Select(y => y).ToDictionary(a => a.Key, b => b.Value));

            rep.Initialize();

            var sfs = rep.SearchForSubfolders(xmlTestFile, "Connections");

            Assert.IsTrue(sfs.Count == 1 && sfs[0].NoOfChilds == 1 && sfs[0].NoOfItems == 0);
            var sf = sfs[0];

            Assert.IsTrue(sf.ChildFolder[0].ChildFolder[0].Name == "ServerInfo");
            Assert.IsTrue(sf.ChildFolder[0].ChildFolder[0].Attributes.Count == 7);
            var attr = sf.ChildFolder[0].ChildFolder[0].Attributes[0];

            Assert.IsTrue(attr.Name == "IP_or_DNSName", attr.Value = "test-db.rigilog.com");
        }