public async Task SearchByIngredients_OkResult() { RecipeRepository recipe = new RecipeRepository(_options, new HttpClient(), _cacheServiceMock.Object); var controller = new RecipesController(recipe, _mapper, _logger); IngredientsRequest ingredients = new IngredientsRequest() { Ingredients = new List <string> { "eggs", "milk", "sugar" } }; var result = await controller.SearchByIngredients(ingredients); result.Should().NotBeNull(); var okResult = result.Should().BeOfType <OkObjectResult>().Subject; Assert.True(okResult.StatusCode.Equals(200)); }
public async Task <IActionResult> SearchByIngredients([FromBody] IngredientsRequest list) { return(await WrapExternalRepositoryCall <IList <Recipe>, IEnumerable <RecipeResponse> >(() => _recipeRepo.FindRecipeByIngredients(Mapper.Map <IngredientsQuery>(list)))); }