Ejemplo n.º 1
0
        public override StringStep BuildStep(Example values)
        {
            var template = MatchableStep;

            foreach (var columnName in values.ColumnNames)
            {
                var columnValue = values.ColumnValues[columnName.Name].TrimWhiteSpaceChars();
                var replace     = BuildColumnValueReplaceRegex(columnName);
                template = replace.Replace(template, columnValue);

                foreach (var row in TableSteps)
                {
                    var newValues = row.ColumnValues.ToDictionary(pair => pair.Key, pair => replace.Replace(pair.Value, columnValue));
                    row.ColumnValues.Clear();
                    foreach (var pair in newValues)
                    {
                        row.ColumnValues.Add(pair.Key, pair.Value);
                    }
                }
            }
            var clone = new StringTableStep(Token, template, Source, SourceLine);

            CloneTableSteps(clone);
            return(clone);
        }
Ejemplo n.º 2
0
 private void CloneTableSteps(StringTableStep clone)
 {
     foreach (var tableStep in TableSteps)
     {
         var clonedValues = tableStep.ColumnValues.ToDictionary(pair => pair.Key, pair => pair.Value);
         var clonedNames  = new ExampleColumns(tableStep.ColumnNames);
         var clonedRow    = new Example(clonedNames, clonedValues);
         clone.AddTableStep(clonedRow);
     }
 }