public void DispatchAddsBarControllerNameToRouteValues(
            DefaultRouteDispatcher sut,
            IDictionary <string, object> routeValues)
        {
            Expression <Action <BarController> > exp = c => c.GetDefault();
            var method = (MethodCallExpression)exp.Body;
            var actual = sut.Dispatch(method, routeValues);

            Assert.Equal("bar", actual.RouteValues["controller"]);
        }
        public void DispatchReturnsResultWithRouterAttributeControllerRouteName(
            DefaultRouteDispatcher sut,
            IDictionary <string, object> routeValues)
        {
            Expression <Action <RouteAttributeController> > exp = c => c.GetDefaultWithoutActionRouteName();
            var method = (MethodCallExpression)exp.Body;
            var actual = sut.Dispatch(method, routeValues);

            Assert.Equal(RouteAttributeController.ControllerRouteName, actual.RouteName);
        }
Exemple #3
0
        public void DispatchDoesNotMutateInputRouteValues(
            DefaultRouteDispatcher sut,
            MethodCallExpression method,
            IDictionary <string, object> routeValues)
        {
            var expected = routeValues.ToList();

            sut.Dispatch(method, routeValues);
            Assert.True(expected.SequenceEqual(routeValues));
        }
        public void DispatchDoesNotAddRouteAttributeControllerNameToRouteValues(
            DefaultRouteDispatcher sut,
            IDictionary <string, object> routeValues)
        {
            Expression <Action <RouteAttributeController> > exp = c => c.GetDefault();
            var method = (MethodCallExpression)exp.Body;
            var actual = sut.Dispatch(method, routeValues);

            Assert.Empty(actual.RouteValues.Where(rv => rv.Key == "controller"));
        }
        public void DispatchPreservesAllRouteValues(
            DefaultRouteDispatcher sut,
            MethodCallExpression method,
            IDictionary <string, object> routeValues)
        {
            var actual = sut.Dispatch(method, routeValues);

            var expected = new HashSet <KeyValuePair <string, object> >(routeValues);

            Assert.True(expected.IsSubsetOf(actual.RouteValues));
        }