public StorEvilScenarioOutlineElement(StorEvilTestProvider provider, UnitTestElement parent, IProject project,
                                       string title, ScenarioOutline scenarioOutline)
     : base(provider, parent, project, title)
 {
     _scenarioOutline = scenarioOutline;
     _namespace = new UnitTestNamespace(project.Name);
 }
 private IEnumerable<Scenario> PreprocessExamples(ScenarioOutline outline)
 {
     var scenario = outline.Scenario;
     var count = 0;
     foreach (var example in outline.Examples)
     {
         yield return
             new Scenario(outline.Id + (count++), scenario.Name,
                          PreprocessLines(scenario.Body, outline.FieldNames, example).ToArray());
     }
 }
Example #3
0
        private void AddScenarioOutline()
        {
            var innerScenario = BuildScenario();

            var count = _currentScenario.RowData.First().Count() - 1;
            var fieldNames = _currentScenario.RowData.First().Take(count).ToArray();
            var examples =
                _currentScenario.RowData.Skip(1).Select(x => x.Take(count).ToArray()).ToArray();

            var scenarioOutline = new ScenarioOutline(_storyId + "-" + _scenarios.Count,
                                                      GetCurrentScenarioName(),
                                                      innerScenario,
                                                      fieldNames,
                                                      examples) { Tags = _currentScenario.Tags };
            _scenarios.Add(scenarioOutline);
        }
        private string BuildExampleRowScenarioName(ScenarioOutline outline, int index)
        {
            var examples = outline.Examples[index];
            var nameParts = new string[examples.Length];

            for (int i = 0; i < examples.Length; i++)
            {
                nameParts[i] = outline.FieldNames.ElementAt(i) + "=" + examples[i];
            }
            return string.Join(", ", nameParts);
        }