private void ExecuteStep(SpecFlowStep step)
        {
            var    docStringArg = step.Argument as DocString;
            string docString    = docStringArg?.Content;
            var    dataTableArg = step.Argument as DataTable;
            Table  dataTable    = null;

            if (dataTableArg != null && dataTableArg.Rows.Any())
            {
                dataTable = new Table(dataTableArg.Rows.First().Cells.Select(c => c.Value).ToArray());
                foreach (var row in dataTableArg.Rows.Skip(1))
                {
                    dataTable.AddRow(row.Cells.Select(c => c.Value).ToArray());
                }
            }
            switch (step.StepKeyword)
            {
            case StepKeyword.Given:
                testRunner.Given(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.When:
                testRunner.When(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.Then:
                testRunner.Then(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.And:
                testRunner.And(step.Text, docString, dataTable, step.Keyword);
                break;

            case StepKeyword.But:
                testRunner.But(step.Text, docString, dataTable, step.Keyword);
                break;
            }
        }
示例#2
0
 public static void But(this ITestRunner testRunner, string text, string multilineTextArg)
 {
     testRunner.But(text, multilineTextArg, null);
 }
示例#3
0
 public static void But(this ITestRunner testRunner, string text)
 {
     testRunner.But(text, null, null);
 }
示例#4
0
 public void But(string step, string multilineTextArg, Table tableArg)
 {
     testRunner.But(step, multilineTextArg, tableArg);
 }
示例#5
0
 public void But(string text, string multilineTextArg, Table tableArg, string keyword = null)
 {
     _runner.But(text, multilineTextArg, tableArg, keyword);
     _outputWriter.WriteStep(text);
     GhprPluginHelper.TestExecutionEngineHelper.OnBut(_engine.ScenarioContext);
 }
示例#6
0
 public void But(string text, string multilineTextArg, Table tableArg, string keyword = null)
 {
     _TestRunner.But(Transform(text), Transform(multilineTextArg), Transform(tableArg), keyword);
 }