コード例 #1
0
        private IEnumerable <Completion> GetCompletionsForBlock(ScenarioBlock scenarioBlock)
        {
            var project = specFlowServices.GetProject(textBuffer);

            List <Completion> result = new List <Completion>();

            GetCompletionsFromProject(project, scenarioBlock, result);

            var specFlowProject = languageService.ProjectScope.SpecFlowProjectConfiguration;

            if (specFlowProject != null)
            {
                foreach (var assemblyName in specFlowProject.RuntimeConfiguration.AdditionalStepAssemblies)
                {
                    string simpleName = assemblyName.Split(new[] { ',' }, 2)[0];

                    var stepProject = VsxHelper.FindProjectByAssemblyName(project.DTE, simpleName);
                    if (stepProject != null)
                    {
                        GetCompletionsFromProject(stepProject, scenarioBlock, result);
                    }
                }
            }

            result.Sort((c1, c2) => string.Compare(c1.DisplayText, c2.DisplayText));

            return(result);
        }
コード例 #2
0
 private void GetCompletionsFromProject(Project project, ScenarioBlock scenarioBlock, List <Completion> result)
 {
     foreach (ProjectItem projectItem in VsxHelper.GetAllProjectItem(project).Where(pi => pi.FileCodeModel != null))
     {
         FileCodeModel codeModel = projectItem.FileCodeModel;
         GetCompletitionsFromCodeElements(codeModel.CodeElements, scenarioBlock, result);
     }
 }
コード例 #3
0
        /// <summary>
        /// Converts the provided <see cref="Gherkin.ScenarioBlock"/> into a <see cref="Augurk.Entities.BlockKeyword"/>.
        /// </summary>
        /// <param name="scenarioBlock">The <see cref="Gherkin.ScenarioBlock"/> that should be converted.</param>
        /// <returns>The converted <see cref="Augurk.Entities.BlockKeyword"/>.</returns>
        public static BlockKeyword ConvertToBlockKeyword(this Gherkin.ScenarioBlock scenarioBlock)
        {
            switch (scenarioBlock)
            {
            case Gherkin.ScenarioBlock.Given:
                return(BlockKeyword.Given);

            case Gherkin.ScenarioBlock.Then:
                return(BlockKeyword.Then);

            case Gherkin.ScenarioBlock.When:
                return(BlockKeyword.When);

            default:
                return(BlockKeyword.None);
            }
        }
コード例 #4
0
 private void GetCompletitionsFromCodeElements(CodeElements codeElements, ScenarioBlock scenarioBlock, List <Completion> result)
 {
     foreach (CodeElement codeElement in codeElements)
     {
         if (codeElement.Kind == vsCMElement.vsCMElementFunction)
         {
             CodeFunction codeFunction = (CodeFunction)codeElement;
             result.AddRange(
                 codeFunction.Attributes.Cast <CodeAttribute>()
                 .Where(attr => attr.FullName.Equals(string.Format("TechTalk.SpecFlow.{0}Attribute", scenarioBlock)))
                 .Select(attr => CreateCompletion(GetRecommendedStepText(attr.Value, codeFunction))));
         }
         else
         {
             GetCompletitionsFromCodeElements(codeElement.Children, scenarioBlock, result);
         }
     }
 }
コード例 #5
0
 private void GetCompletitionsFromCodeElements(CodeElements codeElements, ScenarioBlock scenarioBlock, List<Completion> result)
 {
     foreach (CodeElement codeElement in codeElements)
     {
         if (codeElement.Kind == vsCMElement.vsCMElementFunction)
         {
             CodeFunction codeFunction = (CodeFunction)codeElement;
             result.AddRange(
                 codeFunction.Attributes.Cast<CodeAttribute>()
                 .Where(attr => attr.FullName.Equals(string.Format("TechTalk.SpecFlow.{0}Attribute", scenarioBlock)))
                 .Select(attr => CreateCompletion(GetRecommendedStepText(attr.Value, codeFunction))));
         }
         else
         {
             GetCompletitionsFromCodeElements(codeElement.Children, scenarioBlock, result);
         }
     }
 }
コード例 #6
0
 private void GetCompletionsFromProject(Project project, ScenarioBlock scenarioBlock, List<Completion> result)
 {
     foreach (ProjectItem projectItem in VsxHelper.GetAllProjectItem(project).Where(pi => pi.FileCodeModel != null))
     {
         FileCodeModel codeModel = projectItem.FileCodeModel;
         GetCompletitionsFromCodeElements(codeModel.CodeElements, scenarioBlock, result);
     }
 }
コード例 #7
0
        private IEnumerable<Completion> GetCompletionsForBlock(ScenarioBlock scenarioBlock)
        {
            var project = specFlowServices.GetProject(textBuffer);

            List<Completion> result = new List<Completion>();
            GetCompletionsFromProject(project, scenarioBlock, result);

            var specFlowProject = languageService.ProjectScope.SpecFlowProjectConfiguration;
            if (specFlowProject != null)
            {
                foreach (var assemblyName in specFlowProject.RuntimeConfiguration.AdditionalStepAssemblies)
                {
                    string simpleName = assemblyName.Split(new[] {',' }, 2)[0];

                    var stepProject = VsxHelper.FindProjectByAssemblyName(project.DTE, simpleName);
                    if (stepProject != null)
                        GetCompletionsFromProject(stepProject, scenarioBlock, result);
                }
            }

            result.Sort((c1, c2) => string.Compare(c1.DisplayText, c2.DisplayText));

            return result;
        }