private static SpecFlowProject LoadSpecFlowProjectFromDteProjectInternal(Project project) { string projectFolder = Path.GetDirectoryName(project.FullName); SpecFlowProject specFlowProject = new SpecFlowProject(); specFlowProject.ProjectFolder = projectFolder; specFlowProject.ProjectName = Path.GetFileNameWithoutExtension(project.FullName); specFlowProject.AssemblyName = project.Properties.Item("AssemblyName").Value as string; specFlowProject.DefaultNamespace = project.Properties.Item("DefaultNamespace").Value as string; foreach (ProjectItem projectItem in VsxHelper.GetAllPhysicalFileProjectItem(project)) { if (".feature".Equals(Path.GetExtension(projectItem.Name), StringComparison.InvariantCultureIgnoreCase)) { var featureFile = new SpecFlowFeatureFile(VsxHelper.GetProjectRelativePath(projectItem)); var ns = projectItem.Properties.Item("CustomToolNamespace").Value as string; if (!String.IsNullOrEmpty(ns)) { featureFile.CustomNamespace = ns; } specFlowProject.FeatureFiles.Add(featureFile); } } specFlowProject.Configuration = LoadSpecFlowConfigurationFromDteProjectInternal(project); return(specFlowProject); }
public virtual void RegisterDefaults(IObjectContainer container) { var serviceProvider = container.Resolve <IServiceProvider>(); RegisterVsDependencies(container, serviceProvider); container.RegisterTypeAs <InstallServices, InstallServices>(); container.RegisterTypeAs <VsBrowserGuidanceNotificationService, IGuidanceNotificationService>(); container.RegisterTypeAs <WindowsFileAssociationDetector, IFileAssociationDetector>(); container.RegisterTypeAs <RegistryStatusAccessor, IStatusAccessor>(); container.RegisterTypeAs <IntegrationOptionsProvider, IIntegrationOptionsProvider>(); container.RegisterInstanceAs <IIdeTracer>(VsxHelper.ResolveMefDependency <IVisualStudioTracer>(serviceProvider)); container.RegisterInstanceAs(VsxHelper.ResolveMefDependency <IProjectScopeFactory>(serviceProvider)); container.RegisterTypeAs <TestRunnerEngine, ITestRunnerEngine>(); container.RegisterTypeAs <TestRunnerGatewayProvider, ITestRunnerGatewayProvider>(); container.RegisterTypeAs <MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2010MsTest.ToString()); container.RegisterTypeAs <ReSharper5TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper5.ToString()); container.RegisterTypeAs <ReSharper6TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString()); container.RegisterTypeAs <SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString()); container.RegisterTypeAs <VS2012RunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2012.ToString()); container.RegisterTypeAs <AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString()); container.RegisterTypeAs <StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>(); container.RegisterTypeAs <DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>(); container.RegisterTypeAs <StepTextAnalyzer, IStepTextAnalyzer>(); RegisterCommands(container); }
protected override string GetConfigFileContent() { ProjectItem projectItem = VsxHelper.FindProjectItemByProjectRelativePath(project, "app.config"); if (projectItem == null) { return(null); } return(VsxHelper.GetFileContent(projectItem, true)); }
protected virtual void RegisterVsDependencies(IObjectContainer container, IServiceProvider serviceProvider) { var dte = serviceProvider.GetService(typeof(DTE)) as DTE; if (dte != null) { container.RegisterInstanceAs(dte); container.RegisterInstanceAs((DTE2)dte); } container.RegisterInstanceAs(VsxHelper.ResolveMefDependency <IOutputWindowService>(serviceProvider)); }
private static SpecFlowProjectConfiguration LoadSpecFlowConfigurationFromDteProjectInternal(Project project) { SpecFlowProjectConfiguration configuration = new SpecFlowProjectConfiguration(); ProjectItem projectItem = VsxHelper.FindProjectItemByProjectRelativePath(project, "app.config"); if (projectItem != null) { string configFileContent = VsxHelper.GetFileContent(projectItem); GeneratorConfigurationReader.UpdateConfigFromFileContent(configuration.GeneratorConfiguration, configFileContent); RuntimeConfigurationReader.UpdateConfigFromFileContent(configuration.RuntimeConfiguration, configFileContent); } return(configuration); }
public SpecFlowConfigurationHolder ReadConfiguration() { ProjectItem projectItem = VsxHelper.FindProjectItemByProjectRelativePath(project, "app.config"); if (projectItem == null) { return(new SpecFlowConfigurationHolder()); } string configFileContent = VsxHelper.GetFileContent(projectItem); return(GetConfigurationHolderFromFileContent(configFileContent)); }
public SpecFlowConfigurationHolder ReadConfiguration(IProjectReference projectReference) { var vsProjectReference = VsProjectReference.AssertVsProjectReference(projectReference); ProjectItem projectItem = VsxHelper.FindProjectItemByProjectRelativePath(vsProjectReference.Project, "app.config"); if (projectItem == null) { return(new SpecFlowConfigurationHolder()); } string configFileContent = VsxHelper.GetFileContent(projectItem); return(GetConfigurationHolderFromFileContent(configFileContent)); }
public virtual void RegisterDefaults(IObjectContainer container) { var serviceProvider = container.Resolve <IServiceProvider>(); RegisterVsDependencies(container, serviceProvider); container.RegisterTypeAs <IntegrationOptionsProvider, IIntegrationOptionsProvider>(); container.RegisterInstanceAs <IIdeTracer>(VsxHelper.ResolveMefDependency <IVisualStudioTracer>(serviceProvider)); container.RegisterInstanceAs(VsxHelper.ResolveMefDependency <IProjectScopeFactory>(serviceProvider)); container.RegisterTypeAs <TestRunnerEngine, ITestRunnerEngine>(); container.RegisterTypeAs <TestRunnerGatewayProvider, ITestRunnerGatewayProvider>(); container.RegisterTypeAs <MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.MsTest.ToString()); container.RegisterTypeAs <ReSharper5TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper5.ToString()); container.RegisterTypeAs <ReSharper6TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString()); container.RegisterTypeAs <SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString()); container.RegisterTypeAs <AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString()); RegisterCommands(container); }
protected override string GenerateCode(string inputFileContent) { var generatorServices = new VsGeneratorServices(CurrentProject); using (var testGenerator = generatorServices.CreateTestGenerator()) { string projectFolder = VsxHelper.GetProjectFolder(CurrentProject); var fullPath = Path.GetFullPath(Path.Combine(projectFolder, CodeFilePath)); FeatureFileInput featureFileInput = new FeatureFileInput(FileSystemHelper.GetRelativePath(fullPath, projectFolder)) { FeatureFileContent = inputFileContent }; generationResult = testGenerator.GenerateTestFile(featureFileInput, new GenerationSettings()); if (!generationResult.Success) { return(null); } return(generationResult.GeneratedTestCode); } }
protected override string GenerateCode(string inputFileContent) { IVisualStudioTracer tracer = VsxHelper.ResolveMefDependency <IVisualStudioTracer>(ServiceProvider.GlobalProvider); var generatorServices = new VsGeneratorServices(CurrentProject, new VsSpecFlowConfigurationReader(CurrentProject, tracer), tracer); using (var testGenerator = generatorServices.CreateTestGenerator()) { string projectFolder = VsxHelper.GetProjectFolder(CurrentProject); var fullPath = Path.GetFullPath(Path.Combine(projectFolder, CodeFilePath)); FeatureFileInput featureFileInput = new FeatureFileInput(FileSystemHelper.GetRelativePath(fullPath, projectFolder)) { FeatureFileContent = inputFileContent }; generationResult = testGenerator.GenerateTestFile(featureFileInput, new GenerationSettings()); if (!generationResult.Success) { return(null); } return(generationResult.GeneratedTestCode); } }
public Project GetProject(ITextBuffer textBuffer) { return(VsxHelper.GetCurrentProject(textBuffer, AdaptersFactory, ServiceProvider)); }
internal IClassificationTypeRegistryService ClassificationRegistry = null; // Set via MEF public IntegrationOptions GetOptions() { var dte = VsxHelper.GetDte(ServiceProvider); return(IntegrationOptionsProvider.GetOptions(dte)); }
protected override Func <GeneratorServices> GeneratorServicesProvider(Project project) { IVisualStudioTracer tracer = VsxHelper.ResolveMefDependency <IVisualStudioTracer>(ServiceProvider.GlobalProvider); return(() => new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer)); }