Esempio n. 1
0
        public void Ctor_SetsActionsDataToken()
        {
            var actions = new ReflectedHttpActionDescriptor[0];

            var route = HttpRouteBuilder.BuildDirectRoute("route", 0, actions);

            var actualActions = route.DataTokens[RouteKeys.ActionsDataTokenKey];

            Assert.Equal(actions, actualActions);
        }
Esempio n. 2
0
        public void GetRouteData_AddsDefaultValuesAsOptional()
        {
            var actions = new ReflectedHttpActionDescriptor[] { new ReflectedHttpActionDescriptor() };
            var route   = HttpRouteBuilder.BuildDirectRoute("movies/{id}", 0, actions);

            route.Defaults.Add("id", RouteParameter.Optional);

            var routeData = route.GetRouteData("", new HttpRequestMessage(HttpMethod.Get, "http://localhost/movies"));

            Assert.Equal(RouteParameter.Optional, routeData.Values["id"]);
        }