private void WorkerDoWork(object sender, DoWorkEventArgs e) { try { var parObj = (object[])e.Argument; var parameters = (GeneratorRunnerData)parObj[0]; var codeGeneratorSetup = (ICodeGeneratorSetup)parObj[1]; var prjName = Path.GetFileNameWithoutExtension(parameters.InputAssemblyPath) + ".Tests"; var prj = new CSharpProjectGenerator(this.buildSystem, prjName, parameters.OutputFolder); // var builderFactory = NStub.CSharp.ObjectGeneration.TestBuilderFactory.Default; var testProjectBuilder = new CSharpTestProjectBuilder( this.buildSystem, this.buildData, prj, (pbuildSystem, pbuildData, configuration, codeNamespace) => { // var testBuilders = new TestBuilderFactory(); var codeGenerator = (ICodeGenerator)Activator.CreateInstance( parameters.GeneratorType, new object[] { pbuildSystem, codeNamespace, null, configuration }); // codeNamespace.Dump(3); if (codeGenerator is BaseCSharpCodeGenerator) { ((BaseCSharpCodeGenerator)codeGenerator).BuildProperties = pbuildData as BuildDataDictionary; } return(codeGenerator); }, this.Log); testProjectBuilder.CustomGeneratorParameters = codeGeneratorSetup; testProjectBuilder.GenerateTests(parameters); } catch (Exception ex) { this.Log(ex.ToString()); } }
private void WorkerDoWork(object sender, DoWorkEventArgs e) { try { var parObj = (object[])e.Argument; var parameters = (GeneratorRunnerData)parObj[0]; var codeGeneratorSetup = (ICodeGeneratorSetup)parObj[1]; var prjName = Path.GetFileNameWithoutExtension(parameters.InputAssemblyPath) + ".Tests"; var prj = new CSharpProjectGenerator(this.buildSystem, prjName, parameters.OutputFolder); // var builderFactory = NStub.CSharp.ObjectGeneration.TestBuilderFactory.Default; var testProjectBuilder = new CSharpTestProjectBuilder( this.buildSystem, this.buildData, prj, (pbuildSystem, pbuildData, configuration, codeNamespace) => { // var testBuilders = new TestBuilderFactory(); var codeGenerator = (ICodeGenerator)Activator.CreateInstance( parameters.GeneratorType, new object[] { pbuildSystem, codeNamespace, null, configuration }); // codeNamespace.Dump(3); if (codeGenerator is BaseCSharpCodeGenerator) { ((BaseCSharpCodeGenerator)codeGenerator).BuildProperties = pbuildData as BuildDataDictionary; } return codeGenerator; }, this.Log); testProjectBuilder.CustomGeneratorParameters = codeGeneratorSetup; testProjectBuilder.GenerateTests(parameters); } catch (Exception ex) { this.Log(ex.ToString()); } }