Example #1
0
        public void MergeChildrenTest_Root()
        {
            var sut    = new RoleXmlPatchHelperEx();
            var target = ParseXml("<root />");
            var patch  = ParseIXml("<root />");

            sut.MergeChildren(target, patch, false);

            Assert.AreEqual(0, target.ChildNodes.Count);
        }
Example #2
0
        public void MergeChildrenTest_AddChild()
        {
            var sut    = new RoleXmlPatchHelperEx();
            var target = ParseXml("<root />");
            var patch  = ParseIXml("<root><child /></root>");

            sut.MergeChildren(target, patch, false);

            Assert.AreEqual(1, target.ChildNodes.Count);
            Assert.AreEqual("child", target.ChildNodes[0].Name);
        }
Example #3
0
        public void MergeChildrenTest_RemoveChild()
        {
            var sut    = new RoleXmlPatchHelperEx();
            var target = ParseXml(
                "<configuration>" +
                " <root>" +
                "   <child1 />" +
                " </root>" +
                "</configuration>");
            var patch = ParseIXml(
                "<configuration xmlns:patch=\"http://www.sitecore.net/xmlconfig/\">" +
                " <root>" +
                "   <child1>" +
                "     <patch:delete />" +
                "   </child1>" +
                " </root>" +
                "</configuration>");

            sut.MergeChildren(target, patch, false);

            Assert.AreEqual(0, target.ChildNodes[0].ChildNodes.Count);
        }