public Message Process(Message request) { var parsedStepText = request.StepNameRequest.StepValue; var isStepPresent = _stepRegistry.ContainsStep(parsedStepText); var message = new Message { MessageId = request.MessageId, MessageType = Message.Types.MessageType.StepNameResponse, StepNameResponse = new StepNameResponse { IsStepPresent = isStepPresent } }; if (!isStepPresent) { return(message); } var stepText = _stepRegistry.GetStepText(parsedStepText); var hasAlias = _stepRegistry.HasAlias(stepText); var info = _stepRegistry.MethodFor(parsedStepText); message.StepNameResponse.HasAlias = hasAlias; message.StepNameResponse.FileName = info.FileName; message.StepNameResponse.Span = new Span { Start = info.Span.Span.Start.Line + 1, StartChar = info.Span.StartLinePosition.Character, End = info.Span.EndLinePosition.Line + 1, EndChar = info.Span.EndLinePosition.Character }; if (hasAlias) { message.StepNameResponse.StepName.AddRange(info.Aliases); } else { message.StepNameResponse.StepName.Add(stepText); } return(message); }
public StepNameResponse Process(StepNameRequest request) { var parsedStepText = request.StepValue; var isStepPresent = _stepRegistry.ContainsStep(parsedStepText); var response = new StepNameResponse { IsStepPresent = isStepPresent }; if (!isStepPresent) { return(response); } var stepText = _stepRegistry.GetStepText(parsedStepText); var hasAlias = _stepRegistry.HasAlias(stepText); var info = _stepRegistry.MethodFor(parsedStepText); response.IsExternal = info.IsExternal; response.HasAlias = hasAlias; if (!response.IsExternal) { response.FileName = info.FileName; response.Span = new Span { Start = info.Span.Span.Start.Line + 1, StartChar = info.Span.StartLinePosition.Character, End = info.Span.EndLinePosition.Line + 1, EndChar = info.Span.EndLinePosition.Character }; } if (hasAlias) { response.StepName.AddRange(info.Aliases); } else { response.StepName.Add(stepText); } return(response); }
public Message Process(Message request) { var parsedStepText = request.StepNameRequest.StepValue; var isValidStep = _stepRegistry.ContainsStep(parsedStepText); var stepText = _stepRegistry.GetStepText(parsedStepText); var hasAlias = _stepRegistry.HasAlias(stepText); var stepNameResponse = StepNameResponse.CreateBuilder() .SetHasAlias(hasAlias) .SetIsStepPresent(isValidStep) .AddStepName(stepText) .Build(); return(Message.CreateBuilder() .SetMessageId(request.MessageId) .SetMessageType(Message.Types.MessageType.StepNameResponse) .SetStepNameResponse(stepNameResponse) .Build()); }
public Message Process(Message request) { var parsedStepText = request.StepNameRequest.StepValue; var isValidStep = _stepRegistry.ContainsStep(parsedStepText); var stepText = _stepRegistry.GetStepText(parsedStepText); var hasAlias = _stepRegistry.HasAlias(stepText); var stepNameResponse = new StepNameResponse() { HasAlias = hasAlias, IsStepPresent = isValidStep, StepName = { stepText }, }; return(new Message() { MessageId = request.MessageId, MessageType = Message.Types.MessageType.StepNameResponse, StepNameResponse = stepNameResponse, }); }