public void GetAllRecipes_ReturnsZeroItems_WhenDBIsEmpty() { mockRepo.Setup(repo => repo.GetAllRecipes()).Returns(GetRecipes(0)); var controller = new RecipesController(mockRepo.Object, mapper); var result = controller.GetAllRecipes(); Assert.IsType <OkObjectResult>(result.Result); }
public void GetAllRecipes_ReturnsOneItem_WhenDBHasOneResource() { mockRepo.Setup(repo => repo.GetAllRecipes()).Returns(GetRecipes(1)); var controller = new RecipesController(mockRepo.Object, mapper); var result = controller.GetAllRecipes(); var okResult = result.Result as OkObjectResult; var recipes = okResult.Value as List <RecipeReadDto>; Assert.Single(recipes); }