private object[] BindArguments(string callUri, MethodInfo method, Verb verb, bool indirectly = false) { var methodUri = Regex.Replace(callUri, "\\?.+", String.Empty); var queryStringParameters = Regex.Matches(callUri, "[?&]([^=]+)=[^&]+").Cast <System.Text.RegularExpressions.Match>(); var queryStringRegex = (queryStringParameters.Any() ? "[?&](" + String.Join("|", queryStringParameters.Select(item => item.Groups[1].Value)) + ")=[^&]+" : String.Empty); var arguments = method.GetParameters() .Select(item => new ArgumentInfo(item, FromQueryStringAttribute.For(item), "&test={?test}", "test")); var operation = new OperationInfo <Verb>( method, (HttpUrl)UrlParser.Parse(methodUri), callUri, new Regex("^" + methodUri + queryStringRegex + "$"), verb, arguments.ToArray()); var request = new RequestInfo(Verb.GET, (HttpUrl)UrlParser.Parse("http://temp.uri" + callUri), new MemoryStream(), new BasicClaimBasedIdentity()); var mapping = new RequestMapping(GetControllerInstance(), operation, (HttpUrl)UrlParser.Parse(methodUri)); if (indirectly) { return(_binder.BindArguments((IRequestInfo)request, (IRequestMapping)mapping)); } return(_binder.BindArguments(request, mapping)); }
public void it_should() { _argumentBinder.BindArguments(_request.Object, _requestMapping.Object); }