コード例 #1
0
        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());
        }
コード例 #2
0
        public async Task <IActionResult> GetAllReviewsForTape([FromRoute] int tapeId)
        {
            var reviews = await ReviewsService.GetAllForTape(tapeId);

            return(Ok(reviews.ToDtos()));
        }