Example #1
0
        public async Task RenderNestedControl()
        {
            // Arrange
            var controlRendering = new ControlRendering();
            var page             = new TestPage();
            var markup           = @"<asp:DropDownList Name=""ddlLanguages""><asp:ListItem Text=""C#""/><asp:ListItem Text=""F#""/><asp:ListItem Text=""VB""/></asp:DropDownList>";
            var writer           = new StringWriter(new StringBuilder());

            // Act
            await controlRendering.RenderAsync(page, markup, writer);

            // Assert
            Assert.Equal(@"<select name=""ddlLanguages""><option name=""ddlLanguages"" value=""C#"">C#</option><option name=""ddlLanguages"" value=""F#"">F#</option><option name=""ddlLanguages"" value=""VB"">VB</option></select>", writer.GetStringBuilder().ToString());
        }
Example #2
0
        public async Task NonExistControlShouldNotBeRendered()
        {
            // Arrange
            var controlRendering = new ControlRendering();
            var page             = new TestPage();
            var markup           = "<asp:Literal Name=\"litPostBack1\" Text=\"IsPostBack: False\"></asp:Literal>";
            var writer           = new StringWriter(new StringBuilder());

            // Act
            await controlRendering.RenderAsync(page, markup, writer);

            // Assert
            Assert.Equal(string.Empty, writer.GetStringBuilder().ToString());
        }