예제 #1
0
 public bool Equals(Example other)
 {
     if (other == null)
         return false;
     if (ReferenceEquals(this, other))
         return true;
     return ToString() == other.ToString();
 }
예제 #2
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;
        }
예제 #3
0
 public virtual 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);
     }
     return new StringStep(template, Source);
 }
 public NBehaveExampleTestElement(Example example, IProjectFile featureFile, IUnitTestProvider testProvider, ProjectModelElementEnvoy projectModel, NBehaveUnitTestElementBase parent)
     : base(featureFile, testProvider, parent.Id + "/" + example, projectModel, parent)
 {
     _example = example;
     _identity = IdentityGenerator.NextValue().ToString().PadLeft(9, '0');
 }
예제 #5
0
 public void AddTableStep(Example row)
 {
     tableSteps.Add(row);
 }
예제 #6
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);
     }
 }
 public void Run(StringStep step, Example example)
 {
     throw new NotSupportedException("NBehave.Spec does not support example-driven scenarios");
 }
예제 #8
0
 public void AddTableStep(Example row)
 {
     tableSteps.Add(row);
 }