public void DispatchAddsFooControllerNameToRouteValues(
     DefaultRouteDispatcher sut,
     IDictionary<string, object> routeValues)
 {
     var method = Reflect<FooController>.GetMethod(c => c.GetDefault());
     var actual = sut.Dispatch(method, routeValues);
     Assert.Equal("foo", actual.RouteValues["controller"]);
 }
 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 DispatchAddsFooControllerNameToRouteValues(
     DefaultRouteDispatcher sut,
     IDictionary<string, object> routeValues)
 {
     Expression<Action<FooController>> exp = c => c.GetDefault();
     var method = (MethodCallExpression)exp.Body;
     var actual = sut.Dispatch(method, routeValues);
     Assert.Equal("foo", actual.RouteValues["controller"]);
 }
 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));
        }
 public void SutIsRouteLinker(DefaultRouteDispatcher sut)
 {
     Assert.IsAssignableFrom<IRouteDispatcher>(sut);
 }
 public void DispatchReturnsResultWithRouterAttributeRouteName(
     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.Equal(RouteAttributeController.RouteName, actual.RouteName);
 }