public OutProcSpecFlowConnector(DeveroomConfiguration configuration, IDeveroomLogger logger, string targetFrameworkMoniker, string extensionFolder)
 {
     _configuration          = configuration;
     _logger                 = logger;
     _targetFrameworkMoniker = targetFrameworkMoniker;
     _extensionFolder        = extensionFolder;
 }
Esempio n. 2
0
 public OutProcSpecFlowConnector(DeveroomConfiguration configuration, IDeveroomLogger logger, TargetFrameworkMoniker targetFrameworkMoniker, string extensionFolder, ProcessorArchitectureSetting processorArchitecture)
 {
     _configuration          = configuration;
     _logger                 = logger;
     _targetFrameworkMoniker = targetFrameworkMoniker;
     _extensionFolder        = extensionFolder;
     _processorArchitecture  = processorArchitecture;
 }
 private static ProcessorArchitectureSetting GetProcessorArchitecture(DeveroomConfiguration deveroomConfiguration, ProjectSettings projectSettings)
 {
     if (deveroomConfiguration.ProcessorArchitecture != ProcessorArchitectureSetting.AutoDetect)
     {
         return(deveroomConfiguration.ProcessorArchitecture);
     }
     if (projectSettings.PlatformTarget == ProjectPlatformTarget.x86)
     {
         return(ProcessorArchitectureSetting.X86);
     }
     if (projectSettings.PlatformTarget == ProjectPlatformTarget.x64)
     {
         return(ProcessorArchitectureSetting.X64);
     }
     return(ProcessorArchitectureSetting.UseSystem);
 }
        private ICollection <DeveroomTag> ParseInternal(ITextSnapshot fileSnapshot, ProjectBindingRegistry bindingRegistry, DeveroomConfiguration deveroomConfiguration)
        {
            var dialectProvider = SpecFlowGherkinDialectProvider.Get(deveroomConfiguration.DefaultFeatureLanguage);
            var parser          = new DeveroomGherkinParser(dialectProvider, _monitoringService);

            parser.ParseAndCollectErrors(fileSnapshot.GetText(), _logger,
                                         out var gherkinDocument, out var parserErrors);

            var result = new List <DeveroomTag>();

            if (gherkinDocument != null)
            {
                AddGherkinDocumentTags(fileSnapshot, bindingRegistry, gherkinDocument, result);
            }

            foreach (var parserException in parserErrors)
            {
                var line       = GetSnapshotLine(parserException.Location, fileSnapshot);
                var startPoint = GetColumnPoint(line, parserException.Location);
                var span       = new SnapshotSpan(startPoint, line.End);

                result.Add(new DeveroomTag(DeveroomTagTypes.ParserError,
                                           span, parserException.Message));
            }

            return(result);
        }
        public ICollection <DeveroomTag> Parse(ITextSnapshot fileSnapshot, ProjectBindingRegistry bindingRegistry, DeveroomConfiguration configuration)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            try
            {
                return(ParseInternal(fileSnapshot, bindingRegistry, configuration));
            }
            catch (Exception ex)
            {
                _logger.LogException(_monitoringService, ex, "Unhandled parsing error");
                return(new List <DeveroomTag>());
            }
            finally
            {
                stopwatch.Stop();
                _logger.LogVerbose($"Parsed buffer v{fileSnapshot.Version.VersionNumber} in {stopwatch.ElapsedMilliseconds}ms on thread {Thread.CurrentThread.ManagedThreadId}");
            }
        }
 public ProjectSystemDeveroomConfigurationProvider(IIdeScope ideScope)
 {
     _configuration = new DeveroomConfiguration(); //TODO: Load solution-level config
 }
        private List <DeveroomTag> ReParse(ITextSnapshot fileSnapshot, ProjectBindingRegistry bindingRegistry, DeveroomConfiguration configuration)
        {
            var tags = new List <DeveroomTag>(_deveroomTagParser.Parse(fileSnapshot, bindingRegistry, configuration));

            tags.Sort((t1, t2) => t1.Span.Start.Position.CompareTo(t2.Span.Start.Position));
            return(tags);
        }
        public IEnumerable <StepDefinitionUsage> FindUsagesFromContent(ProjectStepDefinitionBinding[] stepDefinitions,
                                                                       string featureFileContent, string featureFilePath, DeveroomConfiguration configuration)
        {
            var dialectProvider = SpecFlowGherkinDialectProvider.Get(configuration.DefaultFeatureLanguage);
            var parser          = new DeveroomGherkinParser(dialectProvider, _monitoringService);

            parser.ParseAndCollectErrors(featureFileContent, _logger,
                                         out var gherkinDocument, out _);

            var featureNode = gherkinDocument?.Feature;

            if (featureNode == null)
            {
                yield break;
            }

            var dummyRegistry = new ProjectBindingRegistry
            {
                StepDefinitions = stepDefinitions
            };

            var featureContext = new UsageFinderContext(featureNode);

            foreach (var scenarioDefinition in featureNode.FlattenStepsContainers())
            {
                var context = new UsageFinderContext(scenarioDefinition, featureContext);
                foreach (var step in scenarioDefinition.Steps)
                {
                    var matchResult = dummyRegistry.MatchStep(step, context);
                    if (matchResult == null)
                    {
                        continue; // this will not happen
                    }
                    if (matchResult.HasDefined)
                    {
                        yield return(new StepDefinitionUsage(
                                         GetSourceLocation(step, featureFilePath), step));
                    }
                }
            }
        }
        private IEnumerable <StepDefinitionUsage> FindUsages(ProjectStepDefinitionBinding[] stepDefinitions, string featureFilePath, DeveroomConfiguration configuration)
        {
            var featureFileContent = LoadContent(featureFilePath);

            if (featureFileContent == null)
            {
                return(Enumerable.Empty <StepDefinitionUsage>());
            }

            return(FindUsagesFromContent(stepDefinitions, featureFileContent, featureFilePath, configuration));
        }
 public IEnumerable <StepDefinitionUsage> FindUsages(ProjectStepDefinitionBinding[] stepDefinitions, string[] featureFiles, DeveroomConfiguration configuration)
 {
     return(featureFiles.SelectMany(ff => FindUsages(stepDefinitions, ff, configuration)));
 }
Esempio n. 11
0
 public StubDeveroomConfigurationProvider(DeveroomConfiguration configuration)
 {
     _configuration = configuration;
 }
 public ConfigCache(DeveroomConfiguration configuration, ConfigSource[] configSources)
 {
     Configuration = configuration;
     ConfigSources = configSources;
 }