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); }
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); }
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); }