示例#1
0
 private TestGeneratorResult GenerateCode(string inputFilePath, string inputFileContent, GeneratorServices generatorServices, ProjectSettings projectSettings)
 {
     using (var testGenerator = generatorServices.CreateTestGenerator())
     {
         var fullPath = Path.GetFullPath(Path.Combine(projectSettings.ProjectFolder, inputFilePath));
         FeatureFileInput featureFileInput =
             new FeatureFileInput(FileSystemHelper.GetRelativePath(fullPath, projectSettings.ProjectFolder))
                 {
                     FeatureFileContent = inputFileContent
                 };
         return testGenerator.GenerateTestFile(featureFileInput, new GenerationSettings());
     }
 }
示例#2
0
        private string Generate(string inputFilePath, string inputFileContent, GeneratorServices generatorServices, CodeDomHelper codeDomHelper, ProjectSettings projectSettings)
        {
            string outputFileContent;
            try
            {
                TestGeneratorResult generationResult = GenerateCode(inputFilePath, inputFileContent, generatorServices, projectSettings);

                if (generationResult.Success)
                    outputFileContent = generationResult.GeneratedTestCode;
                else
                    outputFileContent = GenerateError(generationResult, codeDomHelper);
            }
            catch (Exception ex)
            {
                outputFileContent = GenerateError(ex, codeDomHelper);
            }
            return outputFileContent;
        }
        private string Generate(string inputFilePath, string inputFileContent, GeneratorServices generatorServices, CodeDomHelper codeDomHelper)
        {
            string outputFileContent;

            try
            {
                TestGeneratorResult generationResult = GenerateCode(inputFilePath, inputFileContent, generatorServices);

                if (generationResult.Success)
                {
                    outputFileContent = generationResult.GeneratedTestCode;
                }
                else
                {
                    outputFileContent = GenerateError(generationResult, codeDomHelper);
                }
            }
            catch (Exception ex)
            {
                outputFileContent = GenerateError(ex, codeDomHelper);
            }
            return(outputFileContent);
        }
示例#4
0
 private TestGeneratorResult GenerateCode(string inputFilePath, string inputFileContent, GeneratorServices generatorServices,
                                          ProjectSettings projectSettings)
 {
     using (var testGenerator = generatorServices.CreateTestGenerator())
     {
         string fullPath         = Path.GetFullPath(Path.Combine(projectSettings.ProjectFolder, inputFilePath));
         var    featureFileInput =
             new FeatureFileInput(FileSystemHelper.GetRelativePath(fullPath, projectSettings.ProjectFolder))
         {
             FeatureFileContent = inputFileContent
         };
         return(testGenerator.GenerateTestFile(featureFileInput, new GenerationSettings()));
     }
 }