public void  GetRecipes()
        {
            var reviews = new List <Recipe>();
            var review1 = new Recipe()
            {
                RecipeId = 32, RecipeAuthor = "Anis", RecipeDescription = "Tacos"
            };
            var review2 = new Recipe()
            {
                RecipeId = 320, RecipeAuthor = "Anis", RecipeDescription = "Tacos"
            };

            reviews.Add(review1);
            reviews.Add(review2);


            var result1 = new List <Recipe>();
            var result2 = new List <Recipe>();

            using (var context = new InTheKitchenDBContext(testOptions))
            {
                context.Database.EnsureDeletedAsync();
                context.Database.EnsureCreatedAsync();
                context.Add(review1);
                context.Add(review2);
                context.SaveChanges();
                result2 = context.Recipes
                          .Include(r => r.RecipeIngredients)
                          .ThenInclude(ri => ri.Ingredient)
                          .Include(r => r.RecipeTags)
                          .ThenInclude(rt => rt.Tag)
                          .Include(r => r.Steps)
                          .ToList();
            }

            using (var context = new InTheKitchenDBContext(testOptions))
            {
                context.Database.EnsureCreatedAsync();
                var msr = new KitchenRepository(context);
                result1 = (List <Recipe>)msr.GetAllRecipes();
            }

            Assert.Equal(result1.Count, result2.Count);
        }
Example #2
0
        public async Task <ICollection <SentRecipe> > getAllSentRecipe()
        {
            ICollection <Recipe> rs = _repo.GetAllRecipes();

            return(SentRecipe.MapMany(rs));
        }