/
OutOfProcessTestGeneratorFactory.cs
52 lines (43 loc) · 1.65 KB
/
OutOfProcessTestGeneratorFactory.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Diagnostics;
using CommandLine;
using TechTalk.SpecFlow.Generator.Interfaces;
using TechTalk.SpecFlow.IdeIntegration.Options;
using TechTalk.SpecFlow.RemoteAppDomain;
using TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.Parameters;
namespace TechTalk.SpecFlow.IdeIntegration.Generator.OutOfProcess
{
public class OutOfProcessTestGeneratorFactory : IOutOfProcessTestGeneratorFactory
{
private readonly Info _info = new Info();
private readonly OutOfProcessExecutor _outOfProcessExecutor;
private readonly IntegrationOptions _integrationOptions;
public OutOfProcessTestGeneratorFactory(IntegrationOptions integrationOptions)
{
_integrationOptions = integrationOptions;
_outOfProcessExecutor = new OutOfProcessExecutor(_info, integrationOptions);
}
public Version GetGeneratorVersion()
{
var result = _outOfProcessExecutor.Execute(new GetGeneratorVersionParameters()
{
Debug = Debugger.IsAttached
},false);
return Version.Parse(result.Output);
}
public ITestGenerator CreateGenerator(ProjectSettings projectSettings)
{
return new OutOfProcessTestGenerator(_info, projectSettings, _integrationOptions);
}
public bool IsRunning { get; private set; }
public void Setup(string newGeneratorFolder)
{
if (_info.GeneratorFolder == newGeneratorFolder)
return;
_info.GeneratorFolder = newGeneratorFolder;
}
public void EnsureInitialized()
{
}
}
}