public void ShouldProcessExecuteStepRequestForTableParam(Parameter.Types.ParameterType parameterType) { const string parsedStepText = "Foo"; var protoTable = new ProtoTable(); var headers = new ProtoTableRow(); headers.Cells.AddRange(new List <string> { "foo", "bar" }); protoTable.Headers = headers; var row = new ProtoTableRow(); row.Cells.AddRange(new List <string> { "foorow1", "foorow2" }); protoTable.Rows.AddRange(new List <ProtoTableRow>() { row }); var request = new Message() { MessageType = Message.Types.MessageType.ExecuteStep, ExecuteStepRequest = new ExecuteStepRequest() { ActualStepText = parsedStepText, ParsedStepText = parsedStepText, Parameters = { new Parameter() { ParameterType = parameterType, Table = protoTable } }, }, MessageId = 20 }; var mockStepRegistry = new Mock <IStepRegistry>(); mockStepRegistry.Setup(x => x.ContainsStep(parsedStepText)).Returns(true); var fooMethodInfo = new GaugeMethod { Name = "Foo", ParameterCount = 1 }; mockStepRegistry.Setup(x => x.MethodFor(parsedStepText)).Returns(fooMethodInfo); var mockMethodExecutor = new Mock <IMethodExecutor>(); mockMethodExecutor.Setup(e => e.Execute(fooMethodInfo, It.IsAny <string[]>())).Returns(() => new ProtoExecutionResult() { ExecutionTime = 1, Failed = false }); var response = new ExecuteStepProcessor(mockStepRegistry.Object, mockMethodExecutor.Object).Process(request); mockMethodExecutor.Verify(executor => executor.Execute(fooMethodInfo, It.Is <string[]>(strings => HasTable(strings)))); Assert.False(response.ExecutionStatusResponse.ExecutionResult.Failed); }
private static List <string> GetTableRowFor(ProtoTableRow tableRow) { return(tableRow.CellsList.ToList()); }