Пример #1
0
        public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, IDictionary<string, string> expectedProps)
        {
            var absoluteUrl = UrlHelpers.MakeAbsolute(url);
            var actualProps = ReadApiRouteProperties(config, absoluteUrl, httpMethod);

            var verifier = new Verifier();
            verifier.VerifyExpectations(expectedProps, actualProps, url);
        }
Пример #2
0
        public static void HasRoute(RouteCollection routes, string url, IDictionary<string, string> expectedProps)
        {
            var pathUrl = UrlHelpers.PrependTilde(url);
            var httpContext = Mockery.ContextForUrl(pathUrl);
            var routeData = routes.GetRouteData(httpContext);

            if (routeData == null)
            {
                var message = string.Format("Should have found the route to '{0}'", url);
                Asserts.Fail(message);
            }

            var webRouteReader = new WebRouteReader();
            var actualProps = webRouteReader.GetRouteProperties(routeData, httpContext.Request.Params);
            var verifier = new Verifier();
            verifier.VerifyExpectations(expectedProps, actualProps, url);
        }