public void Matches_should_return_true_for_GetEntityList_action_call_handlers() { var policy = new ListingHandlerUrlPolicy(); var action = new ActionCall(typeof(ListingHandler<StubViewModel, StubEntity>), null); Assert.IsTrue(policy.Matches(action, null)); }
public void Build_should_return_route_with_ListRange_as_input_type() { var type = typeof(ListingHandler<StubViewModel, StubEntity>); var policy = new ListingHandlerUrlPolicy(); var action = new ActionCall(type, type.GetMethod("Retrieve")); var route = policy.Build(action); Assert.AreEqual(typeof(ListingOf<StubViewModel>), route.Input.InputType); }
public void Build_should_return_route_with_view_model_name_as_url_without_ViewModel() { var type = typeof(ListingHandler<StubViewModel, StubEntity>); var policy = new ListingHandlerUrlPolicy(); var action = new ActionCall(type, type.GetMethod("Retrieve")); var route = policy.Build(action); Assert.AreEqual("stubes", route.Pattern); }
public void Build_should_return_route_constrained_to_GET_verb() { var type = typeof(ListingHandler<StubViewModel, StubEntity>); var policy = new ListingHandlerUrlPolicy(); var action = new ActionCall(type, type.GetMethod("Retrieve")); var route = policy.Build(action); Assert.AreEqual(1, route.AllowedHttpMethods.Count); CollectionAssert.Contains(route.AllowedHttpMethods, "GET"); }
public void Matches_should_reurn_false_for_NON_GetEntityList_action_call_handlers(Type type) { var policy = new ListingHandlerUrlPolicy(); var action = new ActionCall(type, null); Assert.IsFalse(policy.Matches(action, null)); }