Esempio n. 1
0
        public override StringStep BuildStep(Example values)
        {
            var template = Step;

            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(template, Source, SourceLine);

            CloneTableSteps(clone);
            return(clone);
        }
Esempio 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);
     }
 }
Esempio n. 3
0
        public override StringStep BuildStep(Example values)
        {
            var template = Step;
            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(template, Source, SourceLine);
            CloneTableSteps(clone);
            return clone;
        }
Esempio n. 4
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);
     }
 }
 protected override void Because_of()
 {
     var result = new ScenarioResult(feature, ScenarioTitle);
     var stringTableStep = new StringTableStep("Given something", Source);
     stringTableStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("A"), new ExampleColumn("B"), }),
                                              new Dictionary<string, string> { { "A", "aaa" }, { "B", "bb" } }));
     result.AddActionStepResult(new StepResult(stringTableStep, new Passed()));
     resultPublisher.Notify(result);
 }