public void ElementIsTextNode() { const string pre = @"<root><foo>bar</foo></root>"; const string post = @"<root foo=""bar""></root>"; const string xpath = "//foo"; var task = new ConvertToAttribute(); Run(pre, post, xpath, task); }
public void NameShouldBeSuppliedForCData() { const string pre = @"<root><![CDATA[text]]></root>"; const string xpath = "//text()"; var task = new ConvertToAttribute(); Assert.Throws<RequirementException>(() => Run(pre, null, xpath, task)); }
public void CommentShouldNotBeConvertedWhenTheNamedAttributeAlreadyExists() { const string pre = @"<root foo=""""><!--text--></root>"; const string post = pre; const string xpath = "//comment()"; var task = new ConvertToAttribute {Name = "foo"}; Run(pre, post, xpath, task); }
public void Comment() { const string pre = @"<root><!--text--></root>"; const string post = @"<root foo=""text""></root>"; const string xpath = "//comment()"; var task = new ConvertToAttribute {Name = "foo"}; Run(pre, post, xpath, task); }
public void CData() { const string pre = @"<root><![CDATA[text]]></root>"; const string post = @"<root foo=""text""></root>"; const string xpath = "//text()"; var task = new ConvertToAttribute {Name = "foo"}; Run(pre, post, xpath, task); }
public void ProcessingInstructionShouldNotBeConvertedWhenTheNamedAttributeAlreadyExists() { const string pre = @"<root pi=""""><?pi text?></root>"; const string post = pre; const string xpath = "//processing-instruction()"; var task = new ConvertToAttribute(); Run(pre, post, xpath, task); }
public void ProcessingInstruction() { const string pre = @"<root><?pi text?></root>"; const string post = @"<root pi=""text""></root>"; const string xpath = "//processing-instruction()"; var task = new ConvertToAttribute(); Run(pre, post, xpath, task); }