public string Interpret(string stringWithTokens) { foreach (var pair in _tokenDictionary) { stringWithTokens = stringWithTokens.Replace(string.Format("%{0}%", pair.Key), pair.Value); } return stringWithTokens; } }
public virtual void ApplyContext(ScenarioContext scenarioContext) { foreach (var criterion in Criteria) { foreach (var step in criterion.Steps) { var propertyInfos = step.GetType().GetProperties(); foreach (var propertyInfo in propertyInfos) { if (propertyInfo.PropertyType==typeof(string)) { var oldValue = propertyInfo.GetValue(step).ToString(); var newValue = scenarioContext.Interpret(oldValue); if(propertyInfo.SetMethod!=null) propertyInfo.SetValue(step, newValue); } } } } }