public void FindActions_should_return_actions_calls_for_view_models_only() { IActionSource actionSource = new ListingHandlerActionSource(); TypePool typePool = new TypePool(Assembly.GetExecutingAssembly()); var actionCalls = actionSource.FindActions(typePool).ToList(); Assert.GreaterOrEqual(actionCalls.Count, 1); Assert.IsTrue(actionCalls.Any( ac => ac.HandlerType == typeof(ListingHandler<StubViewModel, StubEntity>) )); }
public void FindActions_should_skip_view_models_that_dont_have_an_entity_type_attribute() { IActionSource actionSource = new ListingHandlerActionSource(); TypePool typePool = new TypePool(Assembly.GetExecutingAssembly()); var actionCalls = actionSource.FindActions(typePool).ToList(); Assert.GreaterOrEqual(actionCalls.Count, 1); Assert.IsFalse(actionCalls.Any( ac => ac.HandlerType == typeof(ListingHandler<NoEntityTypeViewModel, StubEntity>) )); }
public void FindActions_should_return_actions_calls_for_retrieve_method() { IActionSource actionSource = new ListingHandlerActionSource(); TypePool typePool = new TypePool(Assembly.GetExecutingAssembly()); var actionCalls = actionSource.FindActions(typePool).ToList(); Assert.GreaterOrEqual(actionCalls.Count, 1); Assert.IsTrue(actionCalls.Any( ac => ac.Method.Name == "Retrieve" && ac.Method.GetParameters()[0].ParameterType == typeof(ListingOf<StubViewModel>) )); }