public void Should_Generate_No_StepMatches_Response() { var stepId = Guid.NewGuid().ToString(); var json = string.Format("[\"success\",[]]"); var reply = new StepMatchesResponse().JsonText; reply.Should().Be.EqualTo(json); }
public void Should_Generate_Simple_StepMatches_Response() { var stepId = Guid.Empty; var json = @"[""success"",[{""id"":""00000000-0000-0000-0000-000000000000"",""args"":[{""val"":""wired"",""pos"":0}],""source"":null}]]"; var response = new StepMatchesResponse(); response.AddMatch(new StepMatch { StepDefinition = new StepDefinition(), MatchedArguments = new[] { new MatchedArgument { Text = "wired", Position = 0 } } }, stepId); var reply = response.JsonText; reply.Should().Be.EqualTo(json); }
public void Should_Generate_Empty_StepMatches_Response() { var stepId = Guid.NewGuid(); var json = string.Format("[\"success\",[{{\"id\":\"{0}\",\"args\":[],\"source\":null}}]]", stepId); var response = new StepMatchesResponse(); response.AddMatch(new StepMatch { StepDefinition = new StepDefinition() }, stepId); var reply = response.JsonText; reply.Should().Be.EqualTo(json); }
private Response ProcessStepMatches(string step) { var stepMatches = stepMatcher.GetMatches(step); var response = new StepMatchesResponse(); foreach (var stepMatch in stepMatches) { var stepId = GetOrCreateStepId(stepMatch.StepDefinition); response.AddMatch(stepMatch, stepId); } return response; }