コード例 #1
0
        private static RequestContext CreateRequestContext(String adapterName, String method)
        {
            var stubHttpContext = new StubContext();
            var routeData = new RouteData();
            routeData.Values.Add("adapter", adapterName);

            var requestContext = new RequestContext(stubHttpContext, routeData);
                        
            var request = new StubRequest();

            request.SetRawUrl(adapterName);
            request.SetPath(adapterName);
            request.SetHttpMethod(method);

            stubHttpContext.SetRequest(request);
            stubHttpContext.SetResponse(new StubResponse());

            return requestContext;
        }
コード例 #2
0
        private static RequestContext CreateRequestContext(String adapterName, String method, String httpVerb = "GET", String query = null, String id = null)
        {
            var stubHttpContext = new StubContext();
            var routeData = new RouteData();
            routeData.Values.Add("adapter", adapterName);
            routeData.Values.Add("method", method);

            if (id != null)
            {
                routeData.Values.Add("id", id);
            }

            var requestContext = new RequestContext(stubHttpContext, routeData);

            var request = new StubRequest();

            request.SetRawUrl(adapterName);
            request.SetPath(adapterName);
            request.SetHttpMethod(httpVerb);
            request.SetQueryString(query);

            stubHttpContext.SetRequest(request);
            stubHttpContext.SetResponse(new StubResponse());

            return requestContext;
        }