예제 #1
0
        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));
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
            }
        }
예제 #5
0
        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());
            }
        }