コード例 #1
0
        public void FindActions_should_return_actions_calls_for_view_models_only()
        {
            IActionSource actionSource = new GetHandlerActionSource();
            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(GetHandler<StubViewModel, StubEntity>)
            ));
        }
コード例 #2
0
        public void FindActions_should_return_action_calls_for_retrieve_method_with_Edit_input_type()
        {
            IActionSource actionSource = new GetHandlerActionSource();
            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().First().ParameterType == typeof(Edit<StubViewModel>)
            ));
        }
コード例 #3
0
        public void FindActions_should_skip_view_models_that_dont_have_an_entity_type_attribute()
        {
            IActionSource actionSource = new GetHandlerActionSource();
            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(GetHandler<NoEntityTypeViewModel, StubEntity>)
            ));
        }