private IFeatureElement MapToFeatureElement(G.ScenarioDefinition sd) { if (sd == null) { return(null); } var scenario = sd as G.Scenario; if (scenario != null) { return(this.MapToScenario(scenario)); } var scenarioOutline = sd as G.ScenarioOutline; if (scenarioOutline != null) { return(this.MapToScenarioOutline(scenarioOutline)); } var background = sd as G.Background; if (background != null) { return(this.MapToScenario(background)); } throw new ArgumentException("Only arguments of type Scenario, ScenarioOutline and Background are supported."); }
public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children) { Tags = tags; Location = location; Language = language; Keyword = keyword; Name = name; Description = description; Children = children; }
private static Scenario ConvertToCompatibleScenario(Gherkin.Ast.ScenarioDefinition sd) { var convertToCompatibleTags = ConvertToCompatibleTags(sd.GetTags()); var result = sd is global::Gherkin.Ast.ScenarioOutline ? new ScenarioOutline(sd.Keyword, sd.Name, sd.Description, convertToCompatibleTags, ConvertToCompatibleSteps(sd.Steps), ConvertToCompatibleExamples(((global::Gherkin.Ast.ScenarioOutline)sd).Examples)) : new Scenario(sd.Keyword, sd.Name, sd.Description, convertToCompatibleTags, ConvertToCompatibleSteps(sd.Steps)); result.FilePosition = ConvertToCompatibleFilePosition(sd.Location); return(result); }
public Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments) { Tags = tags; Location = location; Language = language; Keyword = keyword; Name = name; Description = description; Background = background; ScenarioDefinitions = scenarioDefinitions; Comments = comments; }
private List<List<string>> RetrieveExamples(ScenarioDefinition sd) { if(!(sd is ScenarioOutline)) return null; var so = sd as ScenarioOutline; var r = new List<List<string>>(); r.Add(so.Examples.First().TableHeader.Cells.Select(x => x.Value).ToList()); var vals = so.Examples.SelectMany(x => x.TableBody); foreach (var v in vals) { r.Add(v.Cells.Select(x => x.Value).ToList()); } return r; }
public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, ScenarioDefinition[] children) : base(tags, location, language, keyword, name, description, children) { if (Children != null) { ScenarioDefinitions = Children.Where(child => !(child is Background)).ToList(); var background = Children.SingleOrDefault(child => child is Background); if (background != null) { Background = (Background)background; } } }
private void FormatScenarioDefinition(ScenarioDefinition scenarioDefinition, StringBuilder result) { FormatTags(scenarioDefinition, result); FormatHasDescription(scenarioDefinition, result); FormatHasSteps(scenarioDefinition, result); result.AppendLine(); var scenarioOutline = scenarioDefinition as ScenarioOutline; if (scenarioOutline != null) { foreach (var examples in scenarioOutline.Examples) { FormatTags(examples, result); FormatHasDescription(examples, result); FormatRow(examples.Header, result); FormatHasRows(examples, result); } } }
public SpecFlowFeature(Tag[] tags, Location location, string language, string keyword, string name, string description, Background background, ScenarioDefinition[] scenarioDefinitions, Comment[] comments, string sourceFilePath) : base(tags, location, language, keyword, name, description, background, scenarioDefinitions, comments) { this.SourceFilePath = sourceFilePath; }