示例#1
0
        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");
        }
示例#2
0
        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");
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        internal static void DefaultUpdate()
        {
            Logging.Log("Updating config with substitution file {0}", Arguments.SubstitutionPath);

            UpdateFile.UpdateFiles(Arguments.SubstitutionPath, TextRendering.TagDictionary, Arguments.OutputFailureContext);
        }
示例#7
0
 public void UpdateAllWhenError_SingleError_ThrowsArgumentException()
 {
     Assert.Throws <NDjangoWrapper.NDjangoWrapperException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution32.xml", new Lazy <TagDictionary>(), false));
 }
示例#8
0
 public void AddAttributeWhenAlreadyExists_ThrowsApplicationException()
 {
     Assert.Throws <ApplicationException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution34.xml", new Lazy <TagDictionary>(), false));
 }
示例#9
0
 public void ChangeAttributeWhenDoesntExists_ThrowsApplicationException()
 {
     Assert.Throws <ApplicationException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution33.xml", new Lazy <TagDictionary>(), false));
 }
示例#10
0
 public void UpdateAllWhenError_ThrowsAggregateException()
 {
     Assert.Throws <AggregateException>(() => UpdateFile.UpdateFiles(@"TestUpdateFiles\TestSubstitution31.xml", new Lazy <TagDictionary>(), false));
 }