예제 #1
0
        public void TesteInserirPedido_Sucesso()
        {
            var id          = 1;
            var name        = "Teste";
            var description = "Testando";
            var imgPath     = "TestePath";

            var recipes = _recipeBusiness.ListRecipes().FirstOrDefault(x => x.Id == id);;

            _recipeBusiness.AddRecipe(new RecipeDto()
            {
                Id          = id,
                Name        = name,
                Description = description,
                ImgPath     = imgPath
            });

            var recipeConsulta = _recipeBusiness.ListRecipes().FirstOrDefault(x => x.Id == id);

            Assert.IsNotNull(recipeConsulta);
            Assert.AreEqual(id, recipeConsulta.Id);
            Assert.AreEqual(name, recipeConsulta.Name);
            Assert.AreEqual(description, recipeConsulta.Description);
            Assert.AreEqual(imgPath, recipeConsulta.ImgPath);
        }
 public ActionResult Post(RecipeDto recipe)
 {
     try
     {
         return(Ok(_recipeBusiness.AddRecipe(recipe)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }