public ActionResult Create(CreateModelView modelView)
        {
            if (!ModelState.IsValid)
                return View(modelView);

            var category = new Category
            {
                Name = modelView.CategoryName
            };

            _categoryRepository.Create(category);
            _unitOfWork.Commit();

            return RedirectToAction("Index");
        }
        public void It_should_display_an_error_message()
        {
            // ARRANGE
            var mvc = new Framework();
            var modelView = new CreateModelView();

            modelView.CategoryName = null;

            // ACT
            var result = mvc.HttpPost<CategoryController, ViewResult>(c => c.Create(modelView), modelView);
            var model = result.ActionResult.Model as CreateModelView;

            // ASSERT
            Assert.That(result.ModelStateValidationResult.HasError<CreateModelView>(mv => mv.CategoryName, "A category is required."));
        }