Exemplo n.º 1
0
        public void IndexPOST_GivenValidModelState_DisclaimerViewModelBuilderShouldBeCalled()
        {
            var model = new DisclaimerViewModel();

            _controller.Index(model);

            A.CallTo(() => _disclaimerViewModelBuilder.BuildAddDisclaimerCommand(model)).MustHaveHappened(Repeated.Exactly.Once);
        }
Exemplo n.º 2
0
        public virtual ActionResult Index(DisclaimerViewModel model)
        {
            if (ModelState.IsValid)
            {
                var command = _disclaimerViewModelBuilder.BuildAddDisclaimerCommand(model);

                _commandDispatcher.Dispatch(command);

                _unitOfWork.SaveChanges();

                return(RedirectToAction(MVC.Home.Tutorial()));
            }

            return(View(model));
        }