Esempio n. 1
0
        public void Update_ModelStateIsNotValid_ShouldReturnBadRequest()
        {
            _controller.ModelState.AddModelError("test", "test");

            var result = _controller.Update(1, _recipe);

            Assert.That(result, Is.TypeOf <BadRequestObjectResult>());
        }
        public void Update_ShouldReturnNoContent_WhenUpdatedExistingRecipe()
        {
            var recipe = TestDataRepository.BuildRecipe();

            _repository.Setup(x => x.FindById(recipe.ID.ToString())).Returns(recipe);
            var result = _recipesController.Update(recipe);

            var res = result as NoContentResult;

            Assert.IsNotNull(res);
        }