public void AppendVariable_ValidVariableName_AppendsRenderValueOrKeyAsString() { const string variableName = "key"; var classBuilder = new CodeDomClassBuilder(); classBuilder.AppendVariable(variableName); string result = classBuilder.Build(ClassName); Assert.That(result, Is.StringContaining("textWriter.Write(RenderValueOrKeyAsString(\"" + variableName + "\"));")); }