protected XControl(string tag, params XControl[] xControls) { _control = new HtmlGeneric(tag); AddRange(xControls); }
public void GenericControl_AutoClose_Checkbox_Com_Atributos_E_InnerText() { HtmlGeneric selfClose = new HtmlGeneric("input"){SelfClose = true}; selfClose.Attributes["type"] = "checkbox"; selfClose.Attributes["value"] = "value"; selfClose.Attributes["name"] = "name"; selfClose.InnerText = "text"; Assert.AreEqual("<input type=\"checkbox\" value=\"value\" name=\"name\" />text", Render(selfClose)); }
public void GenericControl_AutoClose_Img() { HtmlGeneric selfClose = new HtmlGeneric("img"){SelfClose = true}; Assert.AreEqual("<img />", Render(selfClose)); }
private static string Render(HtmlGeneric generic) { StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter); generic.RenderControl(htmlTextWriter); return stringWriter.ToString(); }