public void a_page_with_an_overridden_view_condition_is_always_viewable()
        {
            const FormSection validSection    = FormSection.OrganisationDetails;
            const string      validActionName = "validName";

            config.Fields = new Dictionary <FormSection, FormPageDefinition[]>
            {
                {
                    validSection,
                    new[]
                    {
                        new FormPageDefinition(nameof(ExampleViewModel.Populated), validActionName, true)
                    }
                }
            };

            var result = form.CanViewPage(validSection, validActionName, new ExampleViewModel());

            Assert.IsTrue(result);
        }
Пример #2
0
        protected ActionResult GetPreviousView <T>(int id, FormSection section, T model) where T : IValidatable
        {
            if (!FormDefinition.CanViewPage(section, id, model))
            {
                return(RedirectToPreviousPossibleView(id, section, model));
            }

            var viewPath  = GetViewPath(section, id);
            var viewModel = FormDefinition.GetViewModel(section, id, model);

            return(View(viewPath, viewModel));
        }