public void InsertBeforeWithInvalidXPath() { const string Pre = "<root><first /><last /></root>"; const string XPath = "root"; var task = new AddFragment {Fragment = Fragment, Before = InvalidXPath}; Assert.Throws<TaskExecutionException>(() => Run(Pre, null, XPath, task)); }
public void InsertAfterWithXPathSelectingAnAttribute() { const string Pre = "<root attribute=\"\"><first /><last /></root>"; const string Post = "<root attribute=\"\"><first /><last />" + Fragment + "</root>"; const string XPath = "root"; var task = new AddFragment {Fragment = Fragment, After = "@attribute"}; Run(Pre, Post, XPath, task); }
public void AddFragmentBefore() { const string Pre = "<root><first /><last /></root>"; const string Post = "<root>" + Fragment + "<first /><last /></root>"; const string XPath = "root"; var task = new AddFragment {Fragment = Fragment, Before = "first"}; Run(Pre, Post, XPath, task); }
public void InsertAfterWithNonSelectingXPath() { const string Pre = "<root><first /><last /></root>"; const string Post = "<root><first /><last />" + Fragment + "</root>"; const string XPath = "root"; var task = new AddFragment {Fragment = Fragment, After = "non-existing"}; Run(Pre, Post, XPath, task); }
public void AddFragmentAtDefaultPosition() { const string Pre = "<root />"; const string Post = "<root>" + Fragment + "</root>"; const string XPath = "root"; var task = new AddFragment {Fragment = Fragment}; Run(Pre, Post, XPath, task); }