Ejemplo n.º 1
0
        public void createSavedRecipe_Test()
        {
            //Arrange
            var listitemup = new SavedRecipeInputDto {
                userId   = 1,
                recipeId = 1
            };
            var listitem = new SavedRecipeDto {
                id       = 1,
                userId   = 1,
                recipeId = 1
            };
            var savedrecipelist = new List <SavedRecipeDto>()
            {
                listitem
            };

            //Act
            _savedRecipeRepository.Setup(x => x.CreateSavedRecipe(listitemup)).Returns(savedrecipelist);

            var result = _sut.ServiceCreateSavedRecipe(listitemup);

            //Assert
            result.Should().BeEquivalentTo(savedrecipelist, x => x.ComparingByMembers <RecipeDto>());
        }
Ejemplo n.º 2
0
 public ActionResult <IEnumerable <SavedRecipeDto> > createSavedRecipe(SavedRecipeInputDto recipeToSave)
 {
     // var result = base._savedRecipeRepository.
     // CreateSavedRecipe(new SavedRecipe{id=recipeToSave.id,userId=recipeToSave.userId,recipeId=recipeToSave.recipeId});
     // if(result==null)
     //     return NotFound();
     // var resultDto = result.Select(x=>x.AsDto());
     return(Ok(_savedRecipeService.ServiceCreateSavedRecipe(recipeToSave)));
 }