示例#1
0
 public void ElementListCanRenderAsXml()
 {
     var list = new ElementList(new Element("input", "type=text"), new Element("img", "src=stoopid.gif"));
     var expected = "<input type=\"text\" /><img src=\"stoopid.gif\" />";
     var actual = list.Render(RendersTo.XmlTextWriter);
     Assert.AreEqual(expected, actual);
 }
示例#2
0
 public void CanRenderToXmlWriter()
 {
     ElementList list = new ElementList(
         new Element("b").Update("Chris"),
         new Element("i").Update("Emmitt"));
     string expected = "<b>Chris</b><i>Emmitt</i>";
     string actual;
     using (StringWriter text = new StringWriter())
     {
         XmlTextWriter xml = new XmlTextWriter(text);
         list.Render(xml);
         actual = text.ToString();
     }
     Assert.AreEqual(expected, actual);
 }
示例#3
0
 public void CanRenderToStream()
 {
     ElementList list = new ElementList(
         new Element("b").Update("Chris"),
         new Element("i").Update("Emmitt"));
     string expected = "<b>Chris</b><i>Emmitt</i>";
     string actual;
     byte[] buffer = new byte[expected.Length];
     using (MemoryStream stream = new MemoryStream(buffer))
     {
         list.Render(stream);
         actual = System.Text.ASCIIEncoding.ASCII.GetString(buffer);
     }
     Assert.AreEqual(expected, actual);
 }