private ScenarioSteps CreateScenarioSteps(ScenarioOutline scenarioOutline, Dictionary <string, string> paramSubst)
        {
            ScenarioSteps result = new ScenarioSteps();

            foreach (var scenarioStep in scenarioOutline.Steps)
            {
                var newStep = Clone(scenarioStep);
                newStep.Text = GetReplacedText(newStep.Text, paramSubst);
                newStep.MultiLineTextArgument = GetReplacedText(newStep.MultiLineTextArgument, paramSubst);

                if (newStep.TableArg != null)
                {
                    foreach (var row in newStep.TableArg.Body)
                    {
                        foreach (var cell in row.Cells)
                        {
                            cell.Value = GetReplacedText(cell.Value, paramSubst);
                        }
                    }
                }

                result.Add(newStep);
            }
            return(result);
        }
Exemplo n.º 2
0
        public void Add(ScenarioStep scenarioStep)
        {
            if (ScenarioSteps.ContainsKey(scenarioStep.Id))
            {
                return;
            }

            ScenarioSteps.Add(scenarioStep.Id, scenarioStep);
        }
        private ScenarioSteps CreateScenarioSteps(ScenarioOutline scenarioOutline, Dictionary<string, string> paramSubst)
        {
            ScenarioSteps result = new ScenarioSteps();
            foreach (var scenarioStep in scenarioOutline.Steps)
            {
                var newStep = Clone(scenarioStep);
                newStep.Text = GetReplacedText(newStep.Text, paramSubst);
                newStep.MultiLineTextArgument = GetReplacedText(newStep.MultiLineTextArgument, paramSubst);

                if (newStep.TableArg != null)
                {
                    foreach (var row in newStep.TableArg.Body)
                    {
                        foreach (var cell in row.Cells)
                        {
                            cell.Value = GetReplacedText(cell.Value, paramSubst);
                        }
                    }
                }

                result.Add(newStep);
            }
            return result;
        }
        private static ScenarioSteps CreateTestSteps(int numberOfSteps)
        {
            var steps = new ScenarioSteps();
            for (var i = 0; i < numberOfSteps; i++)
            {
                steps.Add(CreateTestStep("text" + i, StepKeyword.Given));
            }

            return steps;
        }
    // $ANTLR end "exampleSet"


    // $ANTLR start "steps"
    // SpecFlowLangWalker.g:147:1: steps returns [ScenarioSteps steps] : ^( STEPS (step_= step )+ ) ;
    public ScenarioSteps steps() // throws RecognitionException [1]
    {   
        ScenarioSteps steps = default(ScenarioSteps);

        ScenarioStep step_ = default(ScenarioStep);



            steps =  new ScenarioSteps();

        try 
    	{
            // SpecFlowLangWalker.g:151:5: ( ^( STEPS (step_= step )+ ) )
            // SpecFlowLangWalker.g:151:9: ^( STEPS (step_= step )+ )
            {
            	Match(input,STEPS,FOLLOW_STEPS_in_steps996); 

            	Match(input, Token.DOWN, null); 
            	// SpecFlowLangWalker.g:152:13: (step_= step )+
            	int cnt13 = 0;
            	do 
            	{
            	    int alt13 = 2;
            	    int LA13_0 = input.LA(1);

            	    if ( ((LA13_0 >= GIVEN && LA13_0 <= THEN) || (LA13_0 >= AND && LA13_0 <= BUT)) )
            	    {
            	        alt13 = 1;
            	    }


            	    switch (alt13) 
            		{
            			case 1 :
            			    // SpecFlowLangWalker.g:152:14: step_= step
            			    {
            			    	PushFollow(FOLLOW_step_in_steps1013);
            			    	step_ = step();
            			    	state.followingStackPointer--;

            			    	 steps.Add(step_); 

            			    }
            			    break;

            			default:
            			    if ( cnt13 >= 1 ) goto loop13;
            		            EarlyExitException eee13 =
            		                new EarlyExitException(13, input);
            		            throw eee13;
            	    }
            	    cnt13++;
            	} while (true);

            	loop13:
            		;	// Stops C# compiler whinging that label 'loop13' has no statements


            	Match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return steps;
    }