public void UpdateAllKnowsAboutTaggedFiles() { var configs = UpdateFile.UpdateAll(@"TestUpdateFiles\TestSubstitution13.xml", new Dictionary <string, object> { { "FilePath", "TaggedPath" } }); Assert.AreEqual("newvalue", XDocument.Parse(configs.Where(c => c.Item1 == @"TestUpdateFiles\TestConfig-TaggedPath.xml").Single().Item2). XPathSelectElement("/root/value").Value); }
public void AppendAfterWorksWithAmpersandInTag() { var configs = UpdateFile.UpdateAll(@"TestUpdateFiles\TestSubstitution26.xml", new Dictionary <string, object> { { "tagValue", "t&his*text" } }); var nms = new XmlNamespaceManager(new NameTable()); nms.AddNamespace("c", "http://madeup.com"); Assert.AreEqual("t&his*text", XDocument.Parse(configs.Where(c => c.Item1 == @"TestUpdateFiles\TestConfig1.xml").Single().Item2).XPathSelectElement ("/root/testing").Value); }
private static void DefaultUpdate() { Log("Updating config with substitution file {0}", substitutionPath); var tags = LazyTags.Value; var updatedContents = UpdateFile.UpdateAll(substitutionPath, tags); foreach (var updatedContent in updatedContents) { using (var fs = new StreamWriter(updatedContent.Item1)) { fs.Write(updatedContent.Item2); } } }
public void UpdateAllTouchesAllFiles() { var configs = UpdateFile.UpdateAll(@"TestUpdateFiles\TestSubstitution3.xml", new Dictionary <string, object> { { "tagValue", "Tagged!" } }); var nms = new XmlNamespaceManager(new NameTable()); nms.AddNamespace("c", "http://madeup.com"); Assert.AreEqual("newvalue", XDocument.Parse(configs.Where(c => c.Item1 == @"TestUpdateFiles\TestConfig2.xml").Single().Item2). XPathSelectElement("/c:root/c:value", nms).Value); Assert.AreEqual("Tagged!", XDocument.Parse(configs.Where(c => c.Item1 == @"TestUpdateFiles\TestConfig1.xml").Single().Item2).XPathSelectElement ("/root/value").Value); }