protected override TestGeneratorResult GenerateTestFile(ITestGenerator generator, FeatureFileInput featureFileInput, GenerationSettings generationSettings) { try { var result = base.GenerateTestFile(generator, featureFileInput, generationSettings); if (result.IsUpToDate) { outputFile.Skip(); } else { outputFile.Done(task.Errors); } return(result); } catch (Exception ex) { task.RecordException(ex); return(new TestGeneratorResult(new TestGenerationError(ex))); } finally { outputFile = null; } }
public Entity(string name, ILanguageGenerator generator, ITestGenerator testGenerator) : base(name, generator, testGenerator) { Name = name; Supers = new List <Entity>(); Subs = new List <Entity>(); Attributes = new List <AttributeData>(); }
protected override FeatureFileInput CreateFeatureFileInput(FeatureFileInput featureFile, ITestGenerator generator, SpecFlowProject specFlowProject) { var featureFileInput = base.CreateFeatureFileInput(featureFile, generator, specFlowProject); outputFile = task.PrepareOutputFile(generator.GetTestFullPath(featureFileInput)); featureFileInput.GeneratedTestProjectRelativePath = FileSystemHelper.GetRelativePath(outputFile.FilePathForWriting, specFlowProject.ProjectSettings.ProjectFolder); return featureFileInput; }
public TestGeneratorAdapterTests() { testGeneratorDiscoverer = Substitute.For<ITestGeneratorDiscoverer>(); discoveryContext = Substitute.For<IDiscoveryContext>(); discoverySink = Substitute.For<ITestCaseDiscoverySink>(); logger = Substitute.For<IMessageLogger>(); frameworkHandle = Substitute.For<IFrameworkHandle>(); runContext = Substitute.For<IRunContext>(); testGenerator = Substitute.For<ITestGenerator>(); }
public void InitializeProject(string projectPath, string rootNamespace, IEnumerable <string> generatorPlugins) { _specFlowProject = MsBuildProjectReader.LoadSpecFlowProjectFromMsBuild(Path.GetFullPath(projectPath), rootNamespace); var projectSettings = _specFlowProject.ProjectSettings; var testGeneratorFactory = new TestGeneratorFactory(); _testGenerator = testGeneratorFactory.CreateGenerator(projectSettings, generatorPlugins); }
protected override TestGeneratorResult GenerateTestFile(ITestGenerator generator, FeatureFileInput featureFileInput, GenerationSettings generationSettings) { try { var result = base.GenerateTestFile(generator, featureFileInput, generationSettings); if (result.IsUpToDate) outputFile.Skip(); else outputFile.Done(task.Errors); return result; } catch (Exception ex) { task.RecordException(ex); return new TestGeneratorResult(new TestGenerationError(ex)); } finally { outputFile = null; } }
protected virtual FeatureFileInput CreateFeatureFileInput(FeatureFileInput featureFile, ITestGenerator generator, SpecFlowProject specFlowProject) { return(featureFile); }
protected virtual FeatureFileInput CreateFeatureFileInput(FeatureFileInput featureFile, ITestGenerator generator, SpecFlowProject specFlowProject) { return featureFile; }
protected virtual TestGeneratorResult GenerateTestFile(ITestGenerator generator, FeatureFileInput featureFileInput, GenerationSettings generationSettings) { return generator.GenerateTestFile(featureFileInput, generationSettings); }
public TypeData(string name, ILanguageGenerator generator, ITestGenerator testGenerator) { this.generator = generator; this.testGenerator = testGenerator; Name = name; }
public DisposeNotificationTestGenerator(ITestGenerator innerGenerator) { this.innerGenerator = innerGenerator; }
public FeatureCodeBehindGenerator(ITestGenerator testGenerator) { _testGenerator = testGenerator; }
public ExpressListener(ILanguageGenerator generator, ITestGenerator testGenerator) { this.generator = generator; this.testGenerator = testGenerator; }
public SelectType(string name, ILanguageGenerator generator, ITestGenerator testGenerator) : base(name, generator, testGenerator) { }
protected virtual TestGeneratorResult GenerateTestFile(ITestGenerator generator, FeatureFileInput featureFileInput, GenerationSettings generationSettings) { return(generator.GenerateTestFile(featureFileInput, generationSettings)); }
public TestsController(ITestGenerator testGenerator) { _testGenerator = testGenerator; }
protected override FeatureFileInput CreateFeatureFileInput(FeatureFileInput featureFile, ITestGenerator generator, SpecFlowProject specFlowProject) { var featureFileInput = base.CreateFeatureFileInput(featureFile, generator, specFlowProject); outputFile = task.PrepareOutputFile(generator.GetTestFullPath(featureFileInput)); featureFileInput.GeneratedTestProjectRelativePath = FileSystemHelper.GetRelativePath(outputFile.FilePathForWriting, specFlowProject.ProjectSettings.ProjectFolder); return(featureFileInput); }
private static void Generate(Express.ExpressListener listener, string outDir, string outDirTests, ILanguageGenerator generator, ITestGenerator testGenerator) { var codePath = Path.Combine(outDir, generator.FileName); var testPath = Path.Combine(outDirTests, testGenerator.FileName); var codeSb = new StringBuilder(); var testSb = new StringBuilder(); codeSb.AppendLine(generator.Begin()); testSb.AppendLine(testGenerator.Begin()); foreach (var kvp in listener.TypeGraph) { var td = kvp.Value; codeSb.AppendLine(td.ToString()); // Only write tests for entities. var entity = td as Express.Entity; if (entity != null) { testSb.AppendLine(entity.ToTestString()); } } codeSb.AppendLine(generator.End()); testSb.AppendLine(testGenerator.End()); File.WriteAllText(codePath, codeSb.ToString()); File.WriteAllText(testPath, testSb.ToString()); }
public CollectionTypeData(string name, ILanguageGenerator generator, ITestGenerator testGenerator) : base(name, generator, testGenerator) { Values = new List <string>(); }