Esempio n. 1
0
        public void OnActionExecuting_should_load_the_parameter_values_out_of_TempData_when_they_match_the_name_and_are_assignable_to_the_type_of_a_parameter_of_the_action_being_executed()
        {
            var objectAssignableToSomeObject = new ReferenceTypeAssignableToSomeReferenceType();

            var context = new ActionExecutingContext
            {
                Controller       = new SampleController(),
                ActionParameters = new Dictionary <string, object>(),
                ActionDescriptor = GetActionDescriptorStubForIndexAction()
            };

            context.Controller.TempData[PassParametersDuringRedirectAttribute.RedirectParameterPrefix + "viewModel"] = objectAssignableToSomeObject;

            _filter.OnActionExecuting(context);

            context.ActionParameters["viewModel"].ShouldEqual(objectAssignableToSomeObject);
        }
        public void OnActionExecuting_should_load_the_parameter_values_out_of_TempData_when_they_match_the_name_and_are_assignable_to_the_type_of_a_parameter_of_the_action_being_executed()
        {
            var objectAssignableToSomeObject = new ReferenceTypeAssignableToSomeReferenceType();

            var context = new ActionExecutingContext
            {
                Controller = new SampleController(),
                ActionParameters = new Dictionary<string, object>(),
                ActionDescriptor = GetActionDescriptorStubForIndexAction()
            };

            context.Controller.TempData[PassParametersDuringRedirectAttribute.RedirectParameterPrefix + "viewModel"] = objectAssignableToSomeObject;

            _filter.OnActionExecuting(context);

            context.ActionParameters["viewModel"].ShouldEqual(objectAssignableToSomeObject);
        }