protected string GetGeneratedTestCode(FeatureFileInput featureFileInput) { using (var outputWriter = new IndentProcessingWriter(new StringWriter())) { var codeProvider = codeDomHelper.CreateCodeDomProvider(); var codeNamespace = GenerateTestFileCode(featureFileInput); if (codeNamespace == null) { return(""); } var options = new CodeGeneratorOptions { BracingStyle = "C", }; AddSpecFlowHeader(codeProvider, outputWriter); codeProvider.GenerateCodeFromNamespace(codeNamespace, outputWriter, options); AddSpecFlowFooter(codeProvider, outputWriter); outputWriter.Flush(); var generatedTestCode = outputWriter.ToString(); return(FixVBNetGlobalNamespace(generatedTestCode)); } }
public void GenerateTestFile(FeatureFileInput featureFile, CodeDomProvider codeProvider, TextReader inputReader, TextWriter outputWriter) { outputWriter = new IndentProcessingWriter(outputWriter); CodeDomHelper codeDomHelper = new CodeDomHelper(codeProvider); var codeNamespace = GenerateTestFileCode(featureFile, inputReader, codeProvider, codeDomHelper); var options = new CodeGeneratorOptions { BracingStyle = "C" }; AddSpecFlowHeader(codeProvider, outputWriter, codeDomHelper); codeProvider.GenerateCodeFromNamespace(codeNamespace, outputWriter, options); AddSpecFlowFooter(codeProvider, outputWriter, codeDomHelper); outputWriter.Flush(); }
private string GetGeneratedTestCode(FeatureFileInput featureFileInput) { using (var outputWriter = new IndentProcessingWriter(new StringWriter())) { var codeProvider = codeDomHelper.CreateCodeDomProvider(); var codeNamespace = GenerateTestFileCode(featureFileInput); var options = new CodeGeneratorOptions { BracingStyle = "C" }; AddSpecFlowHeader(codeProvider, outputWriter); codeProvider.GenerateCodeFromNamespace(codeNamespace, outputWriter, options); AddSpecFlowFooter(codeProvider, outputWriter); outputWriter.Flush(); return outputWriter.ToString(); } }
private string GetGeneratedTestCode(FeatureFileInput featureFileInput, GenerationSettings settings) { using (var outputWriter = new IndentProcessingWriter(new StringWriter())) { var codeProvider = CreateCodeDomProvider(projectSettings.ProjectPlatformSettings); CodeDomHelper codeDomHelper = CreateCodeDomHelper(codeProvider, settings); var codeNamespace = GenerateTestFileCode(featureFileInput, codeDomHelper); var options = new CodeGeneratorOptions { BracingStyle = "C" }; AddSpecFlowHeader(codeProvider, outputWriter, codeDomHelper); codeProvider.GenerateCodeFromNamespace(codeNamespace, outputWriter, options); AddSpecFlowFooter(codeProvider, outputWriter, codeDomHelper); outputWriter.Flush(); return(outputWriter.ToString()); } }