Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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)
        {
            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);
            }
        }
        protected override Func <GeneratorServices> GeneratorServicesProvider(Project project)
        {
            IVisualStudioTracer tracer = VsxHelper.ResolveMefDependency <IVisualStudioTracer>(ServiceProvider.GlobalProvider);

            return(() => new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer));
        }