Ejemplo n.º 1
0
        internal static void RouteDoesNotHaveMethod(HttpConfiguration config, string url, HttpMethod httpMethod)
        {
            var absoluteUrl = UrlHelpers.MakeAbsolute(url);
            var request = new HttpRequestMessage(httpMethod, absoluteUrl);
            var routeGenerator = new Generator(config, request);

            routeGenerator.CheckNoMethod(url, httpMethod);
        }
Ejemplo n.º 2
0
        public static void RouteDoesNotHaveMethod(HttpConfiguration config, string url, Type controllerType, HttpMethod httpMethod)
        {
            var absoluteUrl = UrlHelpers.MakeAbsolute(url);
            var request = new HttpRequestMessage(httpMethod, absoluteUrl);
            var routeGenerator = new Generator(config, request);

            routeGenerator.CheckControllerHasNoMethod(url, httpMethod, controllerType);
        }
Ejemplo n.º 3
0
        internal static void NoRouteMatches(HttpConfiguration config, string url)
        {
            var absoluteUrl = UrlHelpers.MakeAbsolute(url);
            var request = new HttpRequestMessage(HttpMethod.Get, absoluteUrl);
            var routeGenerator = new Generator(config, request);

            if (routeGenerator.HasMatchedRoute)
            {
                var hasRouteMessage = string.Format("Matched a route for url '{0}'", url);
                Asserts.Fail(hasRouteMessage);
            }
        }
Ejemplo n.º 4
0
        private static IDictionary<string, string> ReadRequestProperties(HttpConfiguration config, string url, HttpMethod httpMethod, string body)
        {
            var request = new HttpRequestMessage(httpMethod, url);
            request.Content = new StringContent(body);

            var routeGenerator = new Generator(config, request);
            return routeGenerator.ReadRequestProperties(url, httpMethod);
        }