Ejemplo n.º 1
0
        private void Initialize()
        {
            specFlowProjectConfiguration = LoadConfiguration();
            gherkinDialectServices       = new GherkinDialectServices(specFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage);

            appConfigTracker                 = new VsProjectFileTracker(project, "App.config", dteWithEvents, visualStudioTracer);
            appConfigTracker.FileChanged    += AppConfigTrackerOnFileChanged;
            appConfigTracker.FileOutOfScope += AppConfigTrackerOnFileOutOfScope;

            var enableAnalysis = integrationOptionsProvider.GetOptions().EnableAnalysis;

            if (enableAnalysis)
            {
                featureFilesTracker        = new ProjectFeatureFilesTracker(this);
                featureFilesTracker.Ready += FeatureFilesTrackerOnReady;

                bindingFilesTracker = new BindingFilesTracker(this);

                stepSuggestionProvider = new VsStepSuggestionProvider(this);
                bindingMatchService    = new BindingMatchService(stepSuggestionProvider);
            }
            initialized = true;

            if (enableAnalysis)
            {
                stepSuggestionProvider.Initialize();
                bindingFilesTracker.Initialize();
                featureFilesTracker.Initialize();
                bindingFilesTracker.Run();
                featureFilesTracker.Run();
            }
        }
        private void Initialize()
        {
            tracer.Trace("Initializing...", "VsProjectScope");
            try
            {
                specFlowProjectConfiguration = LoadConfiguration();
                gherkinDialectServices       = new GherkinDialectServices(specFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage);

                appConfigTracker                 = new VsProjectFileTracker(project, "App.config", dteWithEvents, tracer);
                appConfigTracker.FileChanged    += AppConfigTrackerOnFileChanged;
                appConfigTracker.FileOutOfScope += AppConfigTrackerOnFileOutOfScope;

                var enableAnalysis = integrationOptionsProvider.GetOptions().EnableAnalysis;
                if (enableAnalysis)
                {
                    featureFilesTracker        = new ProjectFeatureFilesTracker(this);
                    featureFilesTracker.Ready += FeatureFilesTrackerOnReady;

                    bindingFilesTracker = new BindingFilesTracker(this);

                    stepSuggestionProvider        = new VsStepSuggestionProvider(this);
                    stepSuggestionProvider.Ready += StepSuggestionProviderOnReady;
                    stepDefinitionMatchService    = new StepDefinitionMatchServiceWithOnlySimpleTypeConverter(stepSuggestionProvider, m_objectContainer, m_runtimeConfiguration);
                }
                tracer.Trace("Initialized", "VsProjectScope");
                initialized = true;

                if (enableAnalysis)
                {
                    tracer.Trace("Starting analysis services...", "VsProjectScope");

                    stepSuggestionProvider.Initialize();
                    bindingFilesTracker.Initialize();
                    featureFilesTracker.Initialize();

                    LoadStepMap();

                    bindingFilesTracker.Run();
                    featureFilesTracker.Run();

                    dteWithEvents.OnBuildDone += BuildEventsOnOnBuildDone;

                    tracer.Trace("Analysis services started", "VsProjectScope");
                }
                else
                {
                    tracer.Trace("Analysis services disabled", "VsProjectScope");
                }
            }
            catch (Exception exception)
            {
                tracer.Trace("Exception: " + exception, "VsProjectScope");
            }
        }