public void GetIngredients() { using var inMemoryDbContext = new InMemoryDbContext(); var vegetables = new ArticleGroup("Vegetables"); var tomato = new Article { Name = "Tomato", ArticleGroup = vegetables, IsInventory = false }; var piece = new Unit("Piece"); inMemoryDbContext.ArticleGroups.Add(vegetables); inMemoryDbContext.Articles.Add(tomato); inMemoryDbContext.Units.Add(piece); var ingredient = inMemoryDbContext.Ingredients.Add(new Ingredient(tomato, 2, piece)); inMemoryDbContext.SaveChanges(); var testee = new IngredientDbAccess(inMemoryDbContext); var result = testee.GetIngredients(); result.Should().Contain(ingredient.Entity); }
/// <inheritdoc /> public IEnumerable <ExistingIngredientDto> GetAllIngredients() { var ingredients = IngredientDbAccess.GetIngredients(); return(Mapper.Map <IEnumerable <ExistingIngredientDto> >(ingredients)); }