public void PatchInstead_Constructor_ValidPatchXml_Works() { var newElement = new XElement("test"); var sut = new PatchInstead("/sites", "*[]", newElement); Assert.AreEqual("test", sut.Replacement.Name); }
public void InsertElement_PatchGenerator_Accepts_Insert() { var ins = new PatchInstead("/sitecore/sites", "site[@name='a']", new XElement("site", new XAttribute("name", "c"))); var xml = XDocument.Parse("<sitecore><sites><site name=\"a\"/></sites></sitecore>"); var sut = new PatchGenerator(xml); var result = sut.GeneratePatchFile(new BasePatch[] { ins }); var sites = result .Element("configuration") .Element("sitecore") .Element("sites") .Elements("site"); Assert.AreEqual(1, sites.Count()); var newSite = result .Element("configuration") .Element("sitecore") .Element("sites") .Element("site"); Assert.IsNotNull(newSite); Assert.AreEqual("c", newSite.Attribute("name").Value); Assert.IsNotNull(newSite.Attribute(Namespaces.Patch + "instead")); }
private void okBtn_Click(object sender, EventArgs e) { var xml = XElement.Parse(newElementTextBox.Text); var patchInstead = new PatchInstead(xPathForParent.Text, xPathForReplacement.Text, xml); Patch = new PatchItem(patchInstead, _treeNode); }
public void PatchInstead_Constructor_ValidPath_Works() { var newElement = new XElement("test"); var sut = new PatchInstead("/sites", "*[]", newElement); Assert.AreEqual("/sites", sut.XPathForParent); }
public void PatchInstead_Constructor_NullPatchXml_Throws() { var sut = new PatchInstead("/sites", "*[]", null); }
public void PatchInstead_Constructor_EmptyXPath_Throws() { var newElement = new XElement("test"); var sut = new PatchInstead("/sites", string.Empty, newElement); }
public void PatchInstead_Constructor_NullXPath_Throws() { var newElement = new XElement("test"); var sut = new PatchInstead("/sites", null, newElement); }
public void PatchInstead_Constructor_EmptyPath_Throws() { var newElement = new XElement("test"); var sut = new PatchInstead(string.Empty, "*[]", newElement); }
public void PatchInstead_Constructor_NullPath_Throws() { var newElement = new XElement("test"); var sut = new PatchInstead(null, "*[]", newElement); }