コード例 #1
0
        public ParsedMethod Parse(Method methodInfo, ParsedArguments parsedArguments)
        {
            var unMatchedRequiredArguments = parsedArguments.UnMatchedRequiredArguments();
            if (unMatchedRequiredArguments.Any())
            {
                throw new MissingArgumentException("Missing arguments")
                          {
                              Arguments = unMatchedRequiredArguments
                                .Select(unmatched => unmatched.Name).ToArray()
                          };
            }
            var convertArgument = new ConvertArgumentsToParameterValue(_configuration.CultureInfo, _configuration.TypeConverter);
            var recognizedActionParameters = convertArgument.GetParametersForMethod(methodInfo,
                parsedArguments.RecognizedArgumentsAsKeyValuePairs());

            return new ParsedMethod( parsedArguments, _typeContainer, _configuration)
                       {
                           RecognizedAction = methodInfo,
                           RecognizedActionParameters = recognizedActionParameters,
                           RecognizedClass = _controller.Type
                       };
        }