/// <summary> /// Generate test class. /// </summary> /// <param name="sourceCode">Some class code.</param> /// <returns>Generated test.</returns> private GeneratedTestClass Produce(string sourceCode) { SyntaxTreeInfoBuilder syntaxTreeInfoBuilder = new SyntaxTreeInfoBuilder(sourceCode); SyntaxTreeInfo syntaxTreeInfo = syntaxTreeInfoBuilder.GetSyntaxTreeInfo(); TestClassTemplateGenerator testTemplatesGenerator = new TestClassTemplateGenerator(syntaxTreeInfo); List <GeneratedTestClass> testTemplates = testTemplatesGenerator.GetTestTemplates().ToList(); return(new GeneratedTestClass(testTemplates.First().TestClassName, testTemplates.First().TestClassData)); }
private TestClassInMemoryInfo Produce(string sourceCode) { SyntaxTreeInfoBuilder syntaxTreeInfoBuilder = new SyntaxTreeInfoBuilder(sourceCode); SyntaxTreeInfo syntaxTreeInfo = syntaxTreeInfoBuilder.GetSyntaxTreeInfo(); TestTemplatesGenerator testTemplatesGenerator = new TestTemplatesGenerator(syntaxTreeInfo); List <TestClassInMemoryInfo> testTemplates = testTemplatesGenerator.GetTestTemplates().ToList(); if (testTemplates.Count > 1) { for (int i = 1; i < testTemplates.Count; ++i) { _additionalProducerBuffer.Post(new TestClassInMemoryInfo(testTemplates.ElementAt(i).TestClassName, testTemplates.ElementAt(i).TestClassData)); } } return(new TestClassInMemoryInfo(testTemplates.First().TestClassName, testTemplates.First().TestClassData)); }