public void Append_SingleLine_GeneratesWriteStatement() { string lineToWrite = "Test"; var classBuilder = new CodeDomClassBuilder(); classBuilder.Append(lineToWrite); string result = classBuilder.Build(ClassName); Assert.That(result, Is.StringContaining("textWriter.Write(\"" + lineToWrite + "\");")); }
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")); }