public async Task GetAllForTape_ShouldReturnAllForTape() { for (var i = 0; i < 10; i++) { _context.Add(new Review { FriendId = i + 1, TapeId = 1, Rating = 5 }); } _context.SaveChanges(); var service = new ReviewsService(_context); var reviewsForTape = await service.GetAllForTape(1); Assert.Equal(10, reviewsForTape.Count()); }
public async Task <IActionResult> GetAllReviewsForTape([FromRoute] int tapeId) { var reviews = await ReviewsService.GetAllForTape(tapeId); return(Ok(reviews.ToDtos())); }