Пример #1
0
        public void Given_Examine_SettingsFile_Add_Searcher_To_Config()
        {
            string pathToConfig = Path.Combine(TestContext.CurrentContext.TestDirectory, TestHelper.ExamineSettingsConfigFile);

            XDocument xmlFile = XDocument.Load(pathToConfig);

            int initialNodeCode = xmlFile.XPathSelectElements(Constants.XpathToTestSearchProviderSectionExists).Count();

            ConfigFileUpdater updater = new ConfigFileUpdater(xmlFile);

            XDocument updateDocument = updater.UpdateXmlFile(Constants.XpathToTestSearchProviderSectionExists,
                                                             Constants.ExamineSearchProviderFragmentXml, Constants.XpathToInsertSearchProviderSectionAfter);


            int nodeCountAfterUpdate = updateDocument.XPathSelectElements(Constants.XpathToTestSearchProviderSectionExists).Count();

            Assert.AreNotEqual(initialNodeCode, nodeCountAfterUpdate);
        }
Пример #2
0
        public void Given_Examine_IndexFile_With_Media_Index_Expect_Another_Media_Index_To_Not_Add()
        {
            string pathToConfig = Path.Combine(TestContext.CurrentContext.TestDirectory, @"config\ExamineIndexWithMediaIndex.config");

            XDocument xmlFile = XDocument.Load(pathToConfig);

            string xpathToTestSectionExists = Constants.XpathToTestIndexSectionExists;

            int initialNodeCode = xmlFile.XPathSelectElements(xpathToTestSectionExists).Count(); //expect it to be 1

            ConfigFileUpdater updater = new ConfigFileUpdater(xmlFile);

            string xmlElementToInsert = Constants.ExamineIndexFragmentXml;

            XDocument updateDocument = updater.UpdateXmlFile(xpathToTestSectionExists, xmlElementToInsert, Constants.XpathToInsertIndexSectionAfter);

            int nodeCountAfterUpdate = updateDocument.XPathSelectElements(xpathToTestSectionExists).Count();

            Assert.AreEqual(initialNodeCode, nodeCountAfterUpdate);
        }
Пример #3
0
        public void Given_Examine_IndexFile_Add_MediaIndex_To_Config()
        {
            string pathToConfig = Path.Combine(TestContext.CurrentContext.TestDirectory, TestHelper.ExamineIndexConfigFile);

            XDocument xmlFile = XDocument.Load(pathToConfig);

            string xpathToTestSectionExists = Constants.XpathToTestIndexSectionExists;

            int initialNodeCode = xmlFile.XPathSelectElements(xpathToTestSectionExists).Count();

            ConfigFileUpdater updater = new ConfigFileUpdater(xmlFile);

            string xmlElementToInsert = Constants.ExamineIndexFragmentXml;

            XDocument updateDocument = updater.UpdateXmlFile(xpathToTestSectionExists, xmlElementToInsert, Constants.XpathToInsertIndexSectionAfter);

            int nodeCountAfterUpdate = updateDocument.XPathSelectElements(xpathToTestSectionExists).Count();

            Assert.AreNotEqual(initialNodeCode, nodeCountAfterUpdate);
        }