public void AppendCodeSnippet_ChildNode_OpensCodeBlockCorrectly()
        {
            string codeStatement = "for (int c = 0; c < 10; c++)";

            var classBuilder = new CodeDomClassBuilder();
            classBuilder.AppendCodeSnippet(codeStatement, true);
            string result = classBuilder.Build(ClassName);
            Assert.That(result, Is.StringContaining(codeStatement + "//;"));
        }
        public void WriteNewLineIfRepeated_RepeatedCode_AppendsNewline()
        {
            var classBuilder = new CodeDomClassBuilder();
            classBuilder.AppendCodeSnippet("for (int c = 0; c < 3; c++)", true);
            classBuilder.Append("Test");
            classBuilder.RenderEndBlock();
            string templateSource = classBuilder.Build(ClassName);
            var result = GenerateTemplateFromSource(templateSource);

            var writer = new StringWriter();
            result.Render(writer, HtmlVersion.XHtml);
            Assert.That(writer.ToString(), Is.EqualTo("Test\r\nTest\r\nTest"));
        }
        public void AppendCodeSnippet_NoChildNodes_BuildsValueCorrectly()
        {
            string codeStatement = "int c = 1";

            var classBuilder = new CodeDomClassBuilder();
            classBuilder.AppendCodeSnippet(codeStatement, false);
            string result = classBuilder.Build(ClassName);
            Assert.That(result, Is.StringContaining(codeStatement + ";"));
        }