public ScenarioOutlineExampleSetViewModel(ScenarioOutlineViewModel scenario, ExampleSet exampleSet)
        {
            ExampleSetNode = exampleSet;

            var table = exampleSet.Table;
            ExampleRows = table.Body.Select(x => new ScenarioOutlineExampleRowViewModel(scenario, table.Header, x)).ToList();
            PlaceholderAffectedSteps = PlaceholderNames.ToDictionary(x => x,
                x => ExampleRows
                    .SelectMany((er, index) => scenario.StepTemplates.Zip(er.Steps, (stepTemplate, step) => new { index, stepTemplate, step }))
                    .Where(a => a.stepTemplate.PlaceHolderNames.Contains(x))
                    .ToLookup(a => a.index, a => a.step)
                    .ToDictionary(g=>g.Key, g=>g.ToList()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts the provided <see cref="SpecFlow.ExampleSet"/> instance into a<see cref="Augurk.Entities.ExampleSet"/> instance.
        /// </summary>
        /// <param name="exampleSet">The <see cref="SpecFlow.ExampleSet"/> instance that should be converted.</param>
        /// <returns>The converted <see cref="Augurk.Entities.ExampleSet"/> instance.</returns>
        public static ExampleSet ConvertToExampleSet(this SpecFlow.ExampleSet exampleSet)
        {
            if (exampleSet == null)
            {
                throw new ArgumentNullException("exampleSet");
            }

            return(new ExampleSet()
            {
                Title = exampleSet.Title,
                Description = exampleSet.Description,
                Keyword = exampleSet.Keyword,
                Tags = exampleSet.Tags.ConvertToStrings(),
                Columns = exampleSet.Table.Header.Cells.Select(cell => cell.Value).ToArray(),
                Rows = exampleSet.Table.Body.Select(row => row.Cells.Select(cell => cell.Value).ToArray()).ToArray()
            });
        }
Ejemplo n.º 3
0
 protected virtual void AppendExampleSetLine(StringBuilder result, GherkinDialect dialect, ExampleSet exampleSet)
 {
     result.AppendFormat("{0}: {1}", dialect.GetBlockKeywords(GherkinBlockKeyword.Examples).First(), exampleSet.Title);
     AppendLine(result);
 }
    // $ANTLR end "examples"


    // $ANTLR start "exampleSet"
    // SpecFlowLangWalker.g:137:1: exampleSet returns [ExampleSet exampleSet] : ^( EXAMPLESET (title_= text )? table_= table ) ;
    public ExampleSet exampleSet() // throws RecognitionException [1]
    {   
        ExampleSet exampleSet = default(ExampleSet);

        Text title_ = default(Text);

        Table table_ = default(Table);


        try 
    	{
            // SpecFlowLangWalker.g:141:5: ( ^( EXAMPLESET (title_= text )? table_= table ) )
            // SpecFlowLangWalker.g:141:9: ^( EXAMPLESET (title_= text )? table_= table )
            {
            	Match(input,EXAMPLESET,FOLLOW_EXAMPLESET_in_exampleSet925); 

            	Match(input, Token.DOWN, null); 
            	// SpecFlowLangWalker.g:142:19: (title_= text )?
            	int alt12 = 2;
            	int LA12_0 = input.LA(1);

            	if ( (LA12_0 == TEXT) )
            	{
            	    alt12 = 1;
            	}
            	switch (alt12) 
            	{
            	    case 1 :
            	        // SpecFlowLangWalker.g:142:19: title_= text
            	        {
            	        	PushFollow(FOLLOW_text_in_exampleSet941);
            	        	title_ = text();
            	        	state.followingStackPointer--;


            	        }
            	        break;

            	}

            	PushFollow(FOLLOW_table_in_exampleSet958);
            	table_ = table();
            	state.followingStackPointer--;


            	Match(input, Token.UP, null); 

            }


                exampleSet =  new ExampleSet(title_, table_);

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