private void AddInstances(ScenarioStep scenarioStep, ScenarioOutline scenarioOutline, Feature feature, StepContext stepContext, INativeSuggestionItemFactory <TNativeSuggestionItem> nativeSuggestionItemFactory)
        {
            foreach (var exampleSet in scenarioOutline.Examples.ExampleSets)
            {
                foreach (var row in exampleSet.Table.Body)
                {
                    var replacedText = paramRe.Replace(scenarioStep.Text,
                                                       match =>
                    {
                        string param    = match.Groups["param"].Value;
                        int headerIndex = Array.FindIndex(exampleSet.Table.Header.Cells, c => c.Value.Equals(param));
                        if (headerIndex < 0)
                        {
                            return(match.Value);
                        }
                        return(row.Cells[headerIndex].Value);
                    });

                    var newStep = scenarioStep.Clone();
                    newStep.Text = replacedText;
                    instances.Add(new StepInstance <TNativeSuggestionItem>(newStep, feature, stepContext, nativeSuggestionItemFactory, 2)
                    {
                        ParentTemplate = this
                    });
                }
            }
        }
Example #2
0
 public void AddSuggestion(IBoundStepSuggestion <TNativeSuggestionItem> stepSuggestion)
 {
     suggestions.Add(stepSuggestion);
     stepSuggestion.MatchGroups.Add(this);
 }