public void ControllerActionCreatePostWithValidModelStateShouldReditect()
        {
            var validRecipeCreateViewModel = TestObjectsFactory.GetValidRecipeCreateViewModel();

            this.MockIdentity();

            var validationController = new ModelStateTestController();
            validationController.TestTryValidateModel(validRecipeCreateViewModel);

            this.controller.WithCallTo(a => a.Create(validRecipeCreateViewModel))
                    .ShouldRedirectTo<RecipesController>(c => c.All(1));

            var modelState = validationController.ModelState;

            Assert.IsTrue(modelState.IsValid);
        }
        public void ControllerActionCreatePostWithInvalidModelStateShouldReturnViewWithErrors()
        {
            var invalidRecipeCreateViewModel = TestObjectsFactory.GetInvalidRecipeCreateViewModel();

            this.MockIdentity();

            var validationController = new ModelStateTestController();
            validationController.TestTryValidateModel(invalidRecipeCreateViewModel);

            var errorMessages = this.GetErrorMessages(validationController.ModelState);

            Assert.AreEqual("The Title must be at least 3 characters long.", errorMessages[0]);
            Assert.AreEqual("The field Preparation must be a string or array type with a minimum length of '100'.", errorMessages[1]);
            Assert.AreEqual("The Tags field is required.", errorMessages[2]);
            Assert.AreEqual("The recipe must contain at least 3 ingredients!", errorMessages[3]);
            Assert.AreEqual("The recipe must contain at least one image!", errorMessages[4]);
        }