private void HandleBackgroundRow(ScenarioLine line) { if (IsNotCommentOrEmpty(line)) { _background.Add(line); } }
private void HandleScenarioExampleRow(ScenarioLine line) { if (_currentScenario != null && line.Text.StartsWith("|")) { _currentScenario.RowData.Add(line.Text.Split('|').Skip(1).Select(v => v.Trim())); } }
private void HandleScenarioLine(ScenarioLine line) { if (IsNotCommentOrEmpty(line)) { _currentScenario.Lines.Add(line); } }
public static ScenarioLine[] GetScenarioLines(TaskScenarioLine[] inLines) { var lines = new ScenarioLine[inLines.Length]; for (int i = 0; i < lines.Length; i++) { lines[i] = new ScenarioLine { Text = inLines[i].Text, LineNumber = inLines[i].LineNumber }; } return(lines); }
private string BuildLine(ScenarioLine line) { var lineCodeBuilder = new StringBuilder(); lineCodeBuilder.AppendFormat( @" if (ShouldContinue) {{ #line {0} StorEvilContexts = ExecuteLine(@""{1}""); #line hidden }} ", line.LineNumber, line.Text.Replace("\"", "\"\"")); return(lineCodeBuilder.ToString()); }
private void HandleStoryTextLine(ScenarioLine line) { if (IsTags(line.Text)) { HandleTags(line.Text); return; } if (IsBackground(line.Text)) { _currentLineHandler = HandleBackgroundRow; return; } if (IsNewScenarioOrOutline(line.Text)) { InitializeNewScenario(line.Text); return; } if (IsStartOfExamples(line.Text)) { _currentLineHandler = HandleScenarioExampleRow; return; } if (IsTableRow(line.Text) && _currentScenario != null && !_currentScenario.IsOutline) { if (_currentScenario.Lines.Count > 0) { var last = _currentScenario.Lines.Last(); _currentScenario.Lines = _currentScenario.Lines.GetRange(0, _currentScenario.Lines.Count() - 1); _currentScenario.Lines.Add(new ScenarioLine { Text = last.Text + "\r\n" + line.Text, LineNumber = last.LineNumber }); return; } } _currentLineHandler(line); }
private ClassificationTypes GetClassificationType(ScenarioLine line, IEnumerable <ScenarioLine> parsedLines, IEnumerable <IScenario> scenarios) { var parsed = parsedLines.FirstOrDefault(l => l.LineNumber == line.LineNumber); if (parsed != null) { var match = _scenarioInterpreter.GetChain(_context, parsed.Text); return(match != null ? ClassificationTypes.ScenarioText : ClassificationTypes.PendingScenarioText); } if (LooksLikeAScenarioTitle(line)) { return(ClassificationTypes.ScenarioTitle); } if (LooksLikeATable(line)) { return(ClassificationTypes.Table); } return(ClassificationTypes.Title); }
private string GetScenarioLine(ScenarioLine scenarioLine) { const string fmt = "#line {0}\r\nExecuteLine(@\"{1}\");\r\n#line hidden\r\n"; return(string.Format(fmt, scenarioLine.LineNumber, scenarioLine.Text.Replace("\"", "\"\""))); }
private bool IsNotCommentOrEmpty(ScenarioLine line) { return(!IsComment(line.Text) && line.Text.Trim().Length > 0); }
private void AppendToStoryName(ScenarioLine line) { _storyName.Append(line.Text + "\r\n"); ApplyTagsFromLastLine(); }
private void AddScenario(ScenarioLine line) { _collection.Add(line); _parent = line; }
private bool LooksLikeAScenarioTitle(ScenarioLine line) { var trimmed = line.Text.Trim(); return(trimmed.StartsWith("Scenario:") || trimmed.StartsWith("Scenario Outline:")); }
private bool LooksLikeATable(ScenarioLine line) { var trimmed = line.Text.Trim(); return(trimmed.StartsWith("|") && trimmed.EndsWith("|")); }