示例#1
0
        private void PopulateStepTextCache()
        {
            var gaugeServiceClient = new GaugeServiceClient();
            var implementedSteps   = _implementationMap.Select(x => x.Value.StepText);
            var unimplementedSteps = gaugeServiceClient.GetAllStepsFromGauge(VsProject)
                                     .Where(s => !_implementationMap.ContainsKey(s.StepValue))
                                     .Select(value => value.ParameterizedStepValue);
            var concepts = new Concept(VsProject).GetAllConcepts();
            var steps    = unimplementedSteps.Union(implementedSteps);

            _stepTextCache = concepts.Select(c => Tuple.Create("Concept", c.StepText))
                             .Union(steps.Where(s => concepts.All(c => string.CompareOrdinal(c.StepText, s) != 0) && !string.IsNullOrEmpty(s))
                                    .Select(s => Tuple.Create("Step", s)));
        }
 internal bool ContainsImplememntationFor(EnvDTE.Project project, string givenText)
 {
     try
     {
         var gaugeServiceClient = new GaugeServiceClient();
         return(string.Compare(gaugeServiceClient.GetParsedStepValueFromInput(project, StepText),
                               gaugeServiceClient.GetParsedStepValueFromInput(project, givenText),
                               StringComparison.Ordinal) == 0);
     }
     catch
     {
         return(false);
     }
 }
示例#3
0
 public Concept Search(string lineText)
 {
     try
     {
         var gaugeServiceClient = new GaugeServiceClient();
         return(GetAllConcepts().FirstOrDefault(
                    concept => string.CompareOrdinal(
                        gaugeServiceClient.GetParsedStepValueFromInput(_project, concept.StepText),
                        gaugeServiceClient.GetParsedStepValueFromInput(_project, lineText)) == 0));
     }
     catch
     {
         return(null);
     }
 }
示例#4
0
        public static IEnumerable <string> GetAllSpecsFromGauge()
        {
            try
            {
                GaugeService.AssertCompatibility();
            }
            catch (GaugeVersionIncompatibleException ex)
            {
                GaugeService.DisplayGaugeNotStartedMessage(GaugeDisplayErrorLevel.Error,
                                                           "Unable to launch Gauge Daemon.\nCheck Gauge output pane for details.", ex.Data["GaugeError"].ToString());
                return(Enumerable.Empty <string>());
            }
            catch (GaugeVersionNotFoundException ex)
            {
                GaugeService.DisplayGaugeNotStartedMessage(GaugeDisplayErrorLevel.Error,
                                                           "Unable to launch Gauge Daemon.\nCheck Gauge output pane for details.", ex.Data["GaugeError"].ToString());
                return(Enumerable.Empty <string>());
            }

            var specifications     = new List <ProtoSpec>();
            var gaugeServiceClient = new GaugeServiceClient();

            try
            {
                foreach (var apiConnection in GaugeService.Instance.GetAllApiConnections())
                {
                    specifications.AddRange(gaugeServiceClient.GetSpecsFromGauge(apiConnection));
                }

                return(specifications.Select(spec => spec.FileName).Distinct());
            }
            catch (GaugeApiInitializationException ex)
            {
                GaugeService.DisplayGaugeNotStartedMessage(GaugeDisplayErrorLevel.Error,
                                                           "Unable to launch Gauge Daemon.\nCheck Gauge output pane for details.", $"STDOUT:\n{ex.Data["STDOUT"]}\nSTDERR:\n{ex.Data["STDERR"]}");
                return(Enumerable.Empty <string>());
            }
        }