Created
January 3, 2016 13:24
-
-
Save miklund/6ff7a9bf8b62c02a6fc9 to your computer and use it in GitHub Desktop.
2011-01-26 How to UnitTest your WebControls rendered HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title: How to UnitTest your WebControls rendered HTML | |
# Author: Mikael Lundin | |
# Link: http://blog.mikaellundin.name/2011/01/26/unittest-how-your-webcontrols-render.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ul = string.Format("<ul{0}{1}>", | |
string.IsNullOrEmpty(cssClass) ? string.Empty : string.Format(@" class=""{0}""", cssClass), | |
string.IsNullOrEmpty(xmlns) ? string.Empty : string.Format(@" xmlns=""{0}""", xmlns));</ul{0}{1}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string Xmlns = "urn:unordered-radio-button-list"; | |
var control = new Template { DataSource = data, Xmlns = Xmlns }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xs:schema id="UnorderedRadioButtonList" | |
targetNamespace="urn:unordered-radio-button-list" | |
elementFormDefault="qualified" | |
xmlns="urn:unordered-radio-button-list" | |
xmlns:mstns="http://www.litemedia.se/UnorderedRadioButtonList.xsd" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<!-- Root element --> | |
<xs:element name="ul"> | |
<xs:complexType> | |
<!-- Unbounded number of elements --> | |
<xs:sequence maxOccurs="unbounded"> | |
<xs:element ref="li" /> | |
</xs:sequence> | |
</xs:complexType> | |
</xs:element> | |
<!-- The LI element--> | |
<xs:element id="li" name="li"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element ref="input" /> | |
<xs:element ref="label" /> | |
</xs:sequence> | |
</xs:complexType> | |
</xs:element> | |
<!-- input element has only attributes --> | |
<xs:element id="input" name="input"> | |
<xs:complexType> | |
<xs:attribute name="id" type="xs:string"></xs:attribute> | |
<xs:attribute name="name" type="xs:string"></xs:attribute> | |
<xs:attribute name="type" type="xs:string" fixed="radio"></xs:attribute> | |
<xs:attribute name="value" type="xs:string"></xs:attribute> | |
</xs:complexType> | |
</xs:element> | |
<!-- label contains for attribute and content --> | |
<xs:element id="label" name="label"> | |
<xs:complexType> | |
<xs:simpleContent> | |
<xs:extension base="xs:string"> | |
<xs:attribute name="for" type="xs:string"></xs:attribute> | |
</xs:extension> | |
</xs:simpleContent> | |
</xs:complexType> | |
</xs:element> | |
</xs:schema> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment