Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        internal static void DefaultUpdate()
        {
            Logging.Log("Updating config with substitution file {0}", Arguments.SubstitutionPath);

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