Esempio n. 1
0
        protected override Func <GeneratorServices> GeneratorServicesProvider(Project project)
        {
            IVisualStudioTracer tracer = VsxHelper.ResolveMefDependency <IVisualStudioTracer>(ServiceProvider.GlobalProvider);

            IntegrationOptionsProvider = VsxHelper.ResolveMefDependency <IIntegrationOptionsProvider>(ServiceProvider.GlobalProvider);
            return(() => new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer, IntegrationOptionsProvider));
        }
Esempio n. 2
0
//            new TestGeneratorFactory(), //TODO: load through DI
//            false)
//        {
//            this.project = project;
//            this.configurationReader = new VsSpecFlowConfigurationReader(); //TODO: load through DI
//        }
        public VsGeneratorServices(Project project, IVisualStudioTracer visualStudioTracer) : base(
            new TestGeneratorFactory(), //TODO: load through DI
            new RemoteAppDomainTestGeneratorFactory(tracer), //TODO: load through DI
            new VsGeneratorInfoProvider(project, tracer, configurationReader), //TODO: load through DI
            tracer, false)
        {
            this.configurationReader = configurationReader;
        }
        public GherkinLanguageService(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
        {
            this.projectScope = projectScope;
            this.visualStudioTracer = visualStudioTracer;
            AnalyzingEnabled = projectScope.GherkinScopeAnalyzer != null;

            visualStudioTracer.Trace("Language service created", "GherkinLanguageService");
        }
Esempio n. 4
0
        public GherkinLanguageService(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
        {
            this.projectScope       = projectScope;
            this.visualStudioTracer = visualStudioTracer;
            AnalyzingEnabled        = projectScope.GherkinScopeAnalyzer != null;

            visualStudioTracer.Trace("Language service created", "GherkinLanguageService");
        }
Esempio n. 5
0
 public NoProjectScope(GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer)
 {
     GherkinTextBufferParser = new GherkinTextBufferParser(this, visualStudioTracer);
     GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer);
     SpecFlowProjectConfiguration = new SpecFlowProjectConfiguration();
     GherkinDialectServices = new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage); 
     Classifications = classifications;
 }
Esempio n. 6
0
 public NoProjectScope(GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer)
 {
     GherkinTextBufferParser      = new GherkinTextBufferParser(this, visualStudioTracer);
     GherkinProcessingScheduler   = new GherkinProcessingScheduler(visualStudioTracer);
     SpecFlowProjectConfiguration = new SpecFlowProjectConfiguration();
     GherkinDialectServices       = new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage);
     Classifications = classifications;
 }
        public GherkinLanguageService(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer, bool enableStepMatchColoring)
        {
            this.projectScope            = projectScope;
            this.visualStudioTracer      = visualStudioTracer;
            this.enableStepMatchColoring = enableStepMatchColoring && projectScope.StepSuggestionProvider != null;
            AnalyzingEnabled             = projectScope.GherkinScopeAnalyzer != null;

            visualStudioTracer.Trace("Language service created", "GherkinLanguageService");
        }
Esempio n. 8
0
        public GherkinLanguageService(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer, bool enableStepMatchColoring)
        {
            this.projectScope = projectScope;
            this.visualStudioTracer = visualStudioTracer;
            this.enableStepMatchColoring = enableStepMatchColoring && projectScope.StepSuggestionProvider != null;
            AnalyzingEnabled = projectScope.GherkinScopeAnalyzer != null;

            visualStudioTracer.Trace("Language service created", "GherkinLanguageService");
        }
        public VsProjectFileTracker(Project project, string fileName, DteWithEvents dteWithEvents, IVisualStudioTracer tracer, bool followTrackingAfterRename = false) :
            base(project, dteWithEvents, tracer)
        {
            this.followTrackingAfterRename = followTrackingAfterRename;
            this.fileName = fileName;

            SetLastChangeDate(VsxHelper.FindProjectItemByProjectRelativePath(project, fileName));

            SubscribeToDteEvents();
        }
Esempio n. 10
0
 public NoProjectScope(GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer, IIntegrationOptionsProvider integrationOptionsProvider)
 {
     GherkinTextBufferParser    = new GherkinTextBufferParser(this, visualStudioTracer);
     GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer, false);
     SpecFlowConfiguration      = ConfigurationLoader.GetDefault();
     GherkinDialectServices     = new GherkinDialectServices(SpecFlowConfiguration.FeatureLanguage);
     Classifications            = classifications;
     IntegrationOptionsProvider = integrationOptionsProvider;
     Tracer = visualStudioTracer;
 }
Esempio n. 11
0
        public VsProjectFileTracker(Project project, string fileName, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false)
        {
            this.project = project;
            this.followTrackingAfterRename = followTrackingAfterRename;
            this.fileName           = fileName;
            this.visualStudioTracer = visualStudioTracer;

            SetLastChangeDate(VsxHelper.FindProjectItemByProjectRelativePath(project, fileName));
            SubscribeToDteEvents(dteWithEvents);
        }
        public GherkinProcessingScheduler(IVisualStudioTracer visualStudioTracer)
        {
            this.visualStudioTracer = visualStudioTracer;
            
            parsingDispatcher = CreateBackgroundThreadWithDispatcher(ThreadPriority.BelowNormal);
            parsingScheduler = new DispatcherScheduler(parsingDispatcher);
            parsingSubject = new Subject<IGherkinProcessingTask>(parsingScheduler);
            parsingSubject.BufferWithTimeout(parsingDelay, parsingScheduler, flushFirst: true)
                .Subscribe(ApplyTask);

            analyzingSubject = new Subject<IGherkinProcessingTask>(parsingScheduler); //TODO: create separate thread?
            analyzingSubject.BufferWithTimeout(analyzingDelay, parsingScheduler, flushFirst: false)
                .Subscribe(ApplyTask);
        }
Esempio n. 13
0
        public GherkinProcessingScheduler(IVisualStudioTracer visualStudioTracer)
        {
            this.visualStudioTracer = visualStudioTracer;

            parsingDispatcher = CreateBackgroundThreadWithDispatcher(ThreadPriority.BelowNormal);
            parsingScheduler  = new DispatcherScheduler(parsingDispatcher);
            parsingSubject    = new Subject <IGherkinProcessingTask>(parsingScheduler);
            parsingSubject.BufferWithTimeout(parsingDelay, parsingScheduler, flushFirst: true)
            .Subscribe(ApplyTask);

            analyzingSubject = new Subject <IGherkinProcessingTask>(parsingScheduler); //TODO: create separate thread?
            analyzingSubject.BufferWithTimeout(analyzingDelay, parsingScheduler, flushFirst: false)
            .Subscribe(ApplyTask);
        }
Esempio n. 14
0
        public GherkinFileEditorParser(ITextBuffer buffer, IClassificationTypeRegistryService registry, IVisualStudioTracer visualStudioTracer, SpecFlowProject specFlowProject)
        {
            this.buffer = buffer;
            this.visualStudioTracer = visualStudioTracer;
            this.specFlowProject = specFlowProject;
            this.buffer.Changed += BufferChanged;

            this.classifications = new GherkinFileEditorClassifications(registry);

            // initial parsing
            visualStudioTracer.Trace("Initial parsing scheduled", ParserTraceCategory);
            ChangeInfo changeInfo = new ChangeInfo(buffer);
            parsingTask = parsingTaskFactory.StartNew(() =>
                ParseAndTriggerChanges(GherkinFileEditorInfo, changeInfo));
        }
Esempio n. 15
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer, IIntegrationOptionsProvider integrationOptionsProvider, IBindingSkeletonProviderFactory bindingSkeletonProviderFactory)
        {
            Classifications                     = classifications;
            this.project                        = project;
            this.dteWithEvents                  = dteWithEvents;
            this.visualStudioTracer             = visualStudioTracer;
            this.integrationOptionsProvider     = integrationOptionsProvider;
            this.bindingSkeletonProviderFactory = bindingSkeletonProviderFactory;

            var integrationOptions = integrationOptionsProvider.GetOptions();

            parser = new GherkinTextBufferParser(this, visualStudioTracer);
//TODO: enable when analizer is implemented
//            if (integrationOptions.EnableAnalysis)
//                analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);

            GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer, integrationOptions.EnableAnalysis);
        }
Esempio n. 16
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer tracer, IIntegrationOptionsProvider integrationOptionsProvider)
        {
            Classifications    = classifications;
            this.project       = project;
            this.dteWithEvents = dteWithEvents;
            this.tracer        = tracer;
            this.integrationOptionsProvider = integrationOptionsProvider;

            var integrationOptions = integrationOptionsProvider.GetOptions();

            parser = new GherkinTextBufferParser(this, tracer);
//TODO: enable when analizer is implemented
//            if (integrationOptions.EnableAnalysis)
//                analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);

            GherkinProcessingScheduler = new GherkinProcessingScheduler(tracer, integrationOptions.EnableAnalysis);

            GeneratorServices = new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer, integrationOptionsProvider);
        }
Esempio n. 17
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer)
        {
            Classifications         = classifications;
            this.project            = project;
            this.visualStudioTracer = visualStudioTracer;
            //TODO: register for file changes, etc.

            parser   = new GherkinTextBufferParser(this, visualStudioTracer);
            analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);
            GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer);

            specFlowProjectConfigurationReference = new SynchInitializedInstance <SpecFlowProjectConfiguration>(() =>
                                                                                                                DteProjectReader.LoadSpecFlowConfigurationFromDteProject(project) ?? new SpecFlowProjectConfiguration());
            gherkinDialectServicesReference = new SynchInitializedInstance <GherkinDialectServices>(() =>
                                                                                                    new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage));

            appConfigTracker              = new VsProjectFileTracker(project, "App.config", dteWithEvents, visualStudioTracer);
            appConfigTracker.FileChanged += AppConfigTrackerOnFileChanged;
        }
Esempio n. 18
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer)
        {
            Classifications = classifications;
            this.project = project;
            this.visualStudioTracer = visualStudioTracer;
            //TODO: register for file changes, etc.

            parser = new GherkinTextBufferParser(this, visualStudioTracer);
            analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);
            GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer);

            specFlowProjectConfigurationReference = new SynchInitializedInstance<SpecFlowProjectConfiguration>(()=>
                DteProjectReader.LoadSpecFlowConfigurationFromDteProject(project) ?? new SpecFlowProjectConfiguration());
            gherkinDialectServicesReference = new SynchInitializedInstance<GherkinDialectServices>(() =>
                new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage));

            appConfigTracker = new VsProjectFileTracker(project, "App.config", dteWithEvents, visualStudioTracer);
            appConfigTracker.FileChanged += AppConfigTrackerOnFileChanged;
        }
        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);
            }
        }
Esempio n. 20
0
 public VsProjectFileTracker(ProjectItem projectItem, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false) :
     this(projectItem.ContainingProject, VsxHelper.GetProjectRelativePath(projectItem), dteWithEvents, visualStudioTracer, followTrackingAfterRename)
 {
 }
 public GherkinScopeAnalyzer(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
 {
     this.projectScope       = projectScope;
     this.visualStudioTracer = visualStudioTracer;
 }
Esempio n. 22
0
 public static GherkinFileEditorParser GetParser(ITextBuffer buffer, IClassificationTypeRegistryService classificationRegistry, IVisualStudioTracer visualStudioTracer, SpecFlowProject specFlowProject)
 {
     return buffer.Properties.GetOrCreateSingletonProperty(() =>
         new GherkinFileEditorParser(buffer, classificationRegistry, visualStudioTracer, specFlowProject));
 }
Esempio n. 23
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer, IIntegrationOptionsProvider integrationOptionsProvider, IBindingSkeletonProviderFactory bindingSkeletonProviderFactory)
        {
            Classifications = classifications;
            this.project = project;
            this.dteWithEvents = dteWithEvents;
            this.visualStudioTracer = visualStudioTracer;
            this.integrationOptionsProvider = integrationOptionsProvider;
            this.bindingSkeletonProviderFactory = bindingSkeletonProviderFactory;

            var integrationOptions = integrationOptionsProvider.GetOptions();

            parser = new GherkinTextBufferParser(this, visualStudioTracer);
//TODO: enable when analizer is implemented
//            if (integrationOptions.EnableAnalysis)
//                analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);

            GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer, integrationOptions.EnableAnalysis);
        }
Esempio n. 24
0
 public GherkinScopeAnalyzer(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
 {
     this.projectScope = projectScope;
     this.visualStudioTracer = visualStudioTracer;
 }
 public DelegateTask(Action task, IVisualStudioTracer visualStudioTracer)
 {
     this.task = task;
     this.visualStudioTracer = visualStudioTracer;
 }
 public VsProjectFileTracker(ProjectItem projectItem, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false) :
     this(projectItem.ContainingProject, VsxHelper.GetProjectRelativePath(projectItem), dteWithEvents, visualStudioTracer, followTrackingAfterRename)
 {
     
 }
 protected VsRemoteGeneratorServices(ITestGeneratorFactory testGeneratorFactory, bool enableSettingsCache, Project project, IVisualStudioTracer visualStudioTracer)
     : base(testGeneratorFactory, visualStudioTracer, enableSettingsCache)
 {
     this.project = project;
 }
Esempio n. 28
0
        public VsProjectFilesTracker(Project project, string regexPattern, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer) : base(project, dteWithEvents, visualStudioTracer)
        {
            fileNameRe = new Regex(regexPattern, RegexOptions.IgnoreCase);

            SubscribeToDteEvents();
        }
 public GherkinTextBufferParser(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
 {
     this.projectScope = projectScope;
     this.visualStudioTracer = visualStudioTracer;
 }
 public GherkinTextBufferParser(IProjectScope projectScope, IVisualStudioTracer visualStudioTracer)
 {
     this.projectScope       = projectScope;
     this.visualStudioTracer = visualStudioTracer;
 }
Esempio n. 31
0
 protected VsProjectFileTrackerBase(Project project, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer)
 {
     this.project            = project;
     this.dteWithEvents      = dteWithEvents;
     this.visualStudioTracer = visualStudioTracer;
 }
Esempio n. 32
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer tracer, IIntegrationOptionsProvider integrationOptionsProvider)
        {
            Classifications = classifications;
            this.project = project;
            this.dteWithEvents = dteWithEvents;
            this.tracer = tracer;
            this.integrationOptionsProvider = integrationOptionsProvider;

            var integrationOptions = integrationOptionsProvider.GetOptions();

            parser = new GherkinTextBufferParser(this, tracer);
//TODO: enable when analizer is implemented
//            if (integrationOptions.EnableAnalysis)
//                analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);

            GherkinProcessingScheduler = new GherkinProcessingScheduler(tracer, integrationOptions.EnableAnalysis);

            GeneratorServices = new VsGeneratorServices(project, new VsSpecFlowConfigurationReader(project, tracer), tracer);
        }
Esempio n. 33
0
        public VsProjectFilesTracker(Project project, string regexPattern, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer) : base(project, dteWithEvents, visualStudioTracer)
        {
            fileNameRe = new Regex(regexPattern, RegexOptions.IgnoreCase);

            SubscribeToDteEvents();
        }
Esempio n. 34
0
 protected VsProjectFileTrackerBase(Project project, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer)
 {
     this.project = project;
     this.dteWithEvents = dteWithEvents;
     this.visualStudioTracer = visualStudioTracer;
 }
Esempio n. 35
0
 public DelegateTask(Action task, IVisualStudioTracer visualStudioTracer)
 {
     this.task = task;
     this.visualStudioTracer = visualStudioTracer;
 }