public void ElementWithoutChildNodes() { const string pre = @"<root></root>"; const string post = @"<root>post</root>"; const string xpath = "root"; var task = new Set {Value = "post"}; Run(pre, post, xpath, task); }
public void CDataSections() { const string pre = @"<root><![CDATA[text]]></root>"; const string post = @"<root><![CDATA[value]]></root>"; const string xpath = "//text()"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void Comments() { const string pre = @"<root><!--COMMENT--><!--COMMENT--></root>"; const string post = @"<root><!--value--><!--value--></root>"; const string xpath = "//comment()"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void Attribute() { const string pre = @"<root attribute=""""></root>"; const string post = @"<root attribute=""value""></root>"; const string xpath = "root/@attribute"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void Attributes() { const string pre = @"<root a="""" b="""" c=""""></root>"; const string post = @"<root a=""value"" b=""value"" c=""value""></root>"; const string xpath = "//@*"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void ExecuteWithFileSet() { Task task = new Set(); var command = new TaskCommand(task); // This will not actually select a file command.Context["file"] = "file"; Assert.IsTrue(command.Execute() == 0); }
public void ExecuteWithFileNotProperlySet() { Task task = new Set(); var command = new TaskCommand(task); command.Context["file"] = null; // Not selecting any file is not considered an error Assert.IsTrue(command.Execute() == 0); }
public void ProcessingInstructions() { const string pre = @"<root><?foo bar?><?foo bar?></root>"; const string post = @"<root><?foo value?><?foo value?></root>"; const string xpath = "//processing-instruction()"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void NormalText() { const string pre = @"<root></root>"; const string post = @"<root>post</root>"; const string xpath = "root"; var task = new Set {Value = "post"}; Run(pre, post, xpath, task); }
public void TextNodes() { const string pre = @"<root>text</root>"; const string post = @"<root>value</root>"; const string xpath = "//text()"; var task = new Set {Value = "value"}; Run(pre, post, xpath, task); }
public void SpecialText() { const string pre = @"<root></root>"; const string post = @"<root>></root>"; const string xpath = "root"; var task = new Set {Value = ">"}; Run(pre, post, xpath, task); }
public void Task() { Task task = new Set(); var command = new TaskCommand(task); Assert.AreEqual(task, command.Task); }
public void Execute() { Task task = new Set(); var command = new TaskCommand(task); Assert.IsTrue(command.Execute() == 0); }
public void CommandToString() { Task task = new Set(); var command = new TaskCommand(task); Assert.AreEqual("set", command.ToString()); }