private Step CreateStep(Action step, MethodInfo stepMethod, ConversionContext conversionContext) { var stepName = _metadataProvider.GetStepName(stepMethod); var stepTypeName = _metadataProvider.GetStepTypeNameFromFormattedStepName(ref stepName); return(new Step(step, conversionContext.NormalizeStepTypeName(stepTypeName), stepName, conversionContext.NextStepNumber(), _mapExceptionToStatus)); }
private IStep CreateParameterizedStep <TExpression, TContext>(TContext context, Expression <TExpression> stepExpression, ConversionContext conversionContext, ParameterExpression stepTypeParameter, ParameterExpression contextParameter) { var methodExpression = GetMethodExpression(stepExpression); var stepNameFormat = _metadataProvider.GetStepNameFormat(methodExpression.Method); var stepTypeName = _metadataProvider.GetStepTypeName(stepTypeParameter.Name); if (stepTypeName == string.Empty) { stepTypeName = conversionContext.NormalizeStepTypeName(_metadataProvider.GetStepTypeNameFromFormattedStepName(ref stepNameFormat)); } else { conversionContext.StoreLastStepTypeName(stepTypeName); } var action = CompileAction <TContext>(methodExpression, stepTypeParameter, contextParameter); var methodParameterInfo = methodExpression.Method.GetParameters(); var arguments = methodExpression.Arguments.Select((arg, index) => CompileArgument <TContext>(arg, stepTypeParameter, contextParameter, methodParameterInfo[index])).ToArray(); return(new ParameterizedStep <TContext>(methodExpression.Method, context, action, arguments, stepTypeName, stepNameFormat, conversionContext.NextStepNumber(), _mapExceptionToStatus)); }