Exemple #1
0
        private void GenerateStep(CodeMemberMethod testMethod, Step gherkinStep, ParameterSubstitution paramToIdentifier)
        {
            var specFlowStep       = gherkinStep.AsSpecFlowStep();
            var codeExpressionList = new List <CodeExpression> {
                paramToIdentifier.GetSubstitutedString(specFlowStep.Text)
            };

            //if (specFlowStep.Argument != null)
            //    _codeDomHelper.AddLineDirectiveHidden(testMethod.Statements, _specFlowConfiguration);
            codeExpressionList.Add(paramToIdentifier.GetSubstitutedString((specFlowStep.Argument as DocString)?.Content));
            codeExpressionList.Add(GetTableArgExpression(specFlowStep.Argument as DataTable, testMethod.Statements, paramToIdentifier));
            codeExpressionList.Add(new CodePrimitiveExpression(specFlowStep.Keyword));
            //_codeDomHelper.AddLineDirective(specFlowStep, testMethod.Statements, _specFlowConfiguration);
            var runnerExpression = GetTestRunnerExpression();

            testMethod.Statements.Add(new CodeMethodInvokeExpression(runnerExpression, specFlowStep.StepKeyword.ToString(), codeExpressionList.ToArray()));
        }