Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
            }
        }
Esempio 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);
        }