public void ProcessRenderControlMethodFalseTest()
        {
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, null, Language.CSharp));
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, new CodeExpressionStatement(new CodeSnippetExpression("test")), Language.CSharp));

            var invoke = new CodeMethodInvokeExpression(null, "RenderControlX", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            var stmt   = new CodeExpressionStatement(invoke);

            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            invoke = new CodeMethodInvokeExpression(new CodeSnippetExpression(""), "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt   = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            var indexer = new CodeIndexerExpression(new CodeSnippetExpression(""), new CodeExpression[] { new CodePrimitiveExpression(defaultIndex) });

            invoke = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt   = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            var container = new CodeArgumentReferenceExpression("parameterContainer");
            var controls  = new CodePropertyReferenceExpression(container, "Controls");

            indexer = new CodeIndexerExpression(controls, new CodeExpression[] { new CodeSnippetExpression("") });
            invoke  = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt    = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            controls = new CodePropertyReferenceExpression(container, "ControlsX");
            indexer  = new CodeIndexerExpression(controls, new CodeExpression[] { new CodePrimitiveExpression(defaultIndex) });
            invoke   = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt     = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            controls = new CodePropertyReferenceExpression(new CodeSnippetExpression("test"), "Controls");
            indexer  = new CodeIndexerExpression(controls, new CodeExpression[] { new CodePrimitiveExpression(defaultIndex) });
            invoke   = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt     = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));

            container = new CodeArgumentReferenceExpression("parameterContainerX");
            controls  = new CodePropertyReferenceExpression(container, "Controls");
            indexer   = new CodeIndexerExpression(controls, new CodeExpression[] { new CodePrimitiveExpression(defaultIndex) });
            invoke    = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            stmt      = new CodeExpressionStatement(invoke);
            Assert.IsFalse(SectionControlBuilder.ProcessRenderControlMethod(null, null, stmt, Language.CSharp));
        }
        public void ProcessRenderControlMethodTest()
        {
            // Create a statement of the following form:
            // parameterContainer.Controls[0].RenderControl(@__w);
            // where parameterContainer is a parameter.
            var container     = new CodeArgumentReferenceExpression("parameterContainer");
            var controls      = new CodePropertyReferenceExpression(container, "Controls");
            var indexer       = new CodeIndexerExpression(controls, new CodeExpression[] { new CodePrimitiveExpression(defaultIndex) });
            var invoke        = new CodeMethodInvokeExpression(indexer, "RenderControl", new CodeExpression[] { new CodeArgumentReferenceExpression("__w") });
            var stmt          = new CodeExpressionStatement(invoke);
            var renderMethod  = new CodeMemberMethod();
            var renderMembers = GetRenderMembers();
            var buildMembers  = GetBuildMembers();
            var members       = new List <CodeTypeMember>(renderMembers);

            foreach (var m in buildMembers)
            {
                members.Add(m);
            }
            SectionControlBuilder.ProcessRenderControlMethod(members, renderMethod, stmt, Language.CSharp);
            VerifyDefineSection(((CodeMemberMethod)renderMembers[0]).Statements[0], renderMethod.Statements.OfType <CodeStatement>().ToList());
        }