public async Task WishlistRepository_GetWishlist_ReturnList() { // arrange const string username = "******"; const int userId = 1; using var contextFactory = new TestLooseLeafContextFactory(); List <DataAccess.Wishlist> wishlists = new List <DataAccess.Wishlist>() { new DataAccess.Wishlist() { UserId = userId, BookId = 1 }, new DataAccess.Wishlist() { UserId = userId, BookId = 2 }, new DataAccess.Wishlist() { UserId = userId, BookId = 3 } }; using (LooseLeafContext addContext = contextFactory.CreateContext()) { await contextFactory.CreateUser(addContext, username); await contextFactory.CreateBook(addContext, "Book 1", "Author 1"); await contextFactory.CreateBook(addContext, "Book 2", "Author 2"); await contextFactory.CreateBook(addContext, "Book 3", "Author 3"); await addContext.SaveChangesAsync(); await addContext.Wishlists.AddRangeAsync(wishlists); await addContext.SaveChangesAsync(); } using LooseLeafContext context = contextFactory.CreateContext(); IWishlistRepository wishlistRepository = new WishlistRepository(context); // act var books = await wishlistRepository.GetUserWishlist(userId); // assert Assert.Equal(wishlists.Count, books.Count()); }