public void UpdateAllWhenError_SingleError_ThrowsArgumentException() { var content = XDocument.Load(@"TestUpdateFiles\TestConfig1.xml"); Assert.Throws <ArgumentException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution32.xml", new Lazy <TagDictionary>(), false)); content.Save(@"TestUpdateFiles\TestConfig1.xml"); }
public void AddAttributeWhenAlreadyExists_ThrowsApplicationException() { var content = XDocument.Load(@"TestUpdateFiles\TestConfig1.xml"); Assert.Throws <ApplicationException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution34.xml", new Lazy <TagDictionary>(), false)); content.Save(@"TestUpdateFiles\TestConfig1.xml"); }
public void UpdateAllKnowsAboutTaggedFiles() { UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution13.xml", new Dictionary <string, object> { { "FilePath", "TaggedPath" } }.ToLazyTagDictionary(), false); var document = XDocument.Load(@"TestUpdateFiles\TestConfig-TaggedPath.xml"); Assert.AreEqual("newvalue", document.XPathSelectElement("/root/value").Value); }
public void AppendAfterWorksWithAmpersandInTag() { UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution26.xml", new Dictionary <string, object> { { "tagValue", "t&his*text" } }.ToLazyTagDictionary(), false); var document = XDocument.Load(@"TestUpdateFiles\TestConfig1.xml"); var nms = new XmlNamespaceManager(new NameTable()); nms.AddNamespace("c", "http://madeup.com"); Assert.AreEqual("t&his*text", document.XPathSelectElement("/root/testing").Value); }
public void UpdateAllTouchesAllFiles() { UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution3.xml", new Dictionary <string, object> { { "tagValue", "Tagged!" } }.ToLazyTagDictionary(), false); var document = XDocument.Load(@"TestUpdateFiles\TestConfig1.xml"); var document2 = XDocument.Load(@"TestUpdateFiles\TestConfig2.xml"); var nms = new XmlNamespaceManager(new NameTable()); nms.AddNamespace("c", "http://madeup.com"); Assert.AreEqual("newvalue", document2.XPathSelectElement("/c:root/c:value", nms).Value); Assert.AreEqual("Tagged!", document.XPathSelectElement("/root/value").Value); }
internal static void DefaultUpdate() { Logging.Log("Updating config with substitution file {0}", Arguments.SubstitutionPath); UpdateFile.UpdateFiles(Arguments.SubstitutionPath, TextRendering.TagDictionary, Arguments.OutputFailureContext); }
public void UpdateAllWhenError_SingleError_ThrowsArgumentException() { Assert.Throws <NDjangoWrapper.NDjangoWrapperException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution32.xml", new Lazy <TagDictionary>(), false)); }
public void AddAttributeWhenAlreadyExists_ThrowsApplicationException() { Assert.Throws <ApplicationException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution34.xml", new Lazy <TagDictionary>(), false)); }
public void ChangeAttributeWhenDoesntExists_ThrowsApplicationException() { Assert.Throws <ApplicationException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution33.xml", new Lazy <TagDictionary>(), false)); }
public void UpdateAllWhenError_ThrowsAggregateException() { Assert.Throws <AggregateException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution31.xml", new Lazy <TagDictionary>(), false)); }