private string StepMatches(string stepName)
{
var matches = new JArray();
foreach (StepDefinition sd in _repository.StepDefinitions)
{
List<StepArgument> args = sd.ArgumentsFrom(stepName);
if (args != null)
{
var stepMatch = new JObject();
stepMatch.Add("id", sd.Id);
var jsonArgs = new JArray();
foreach (StepArgument arg in args)
{
var jsonArg = new JObject();
jsonArg.Add("val", arg.Val);
jsonArg.Add("pos", arg.Pos);
jsonArgs.Add(jsonArg);
}
stepMatch["args"] = jsonArgs;
matches.Add(stepMatch);
}
}
var response = new JArray();
response.Add("step_matches");
response.Add(matches);
return response.ToString(Formatting.None);
}