Пример #1
0
 public IActionResult GetReviewByUserForTape(int?friendId, int?tapeId)
 {
     if (friendId == null || tapeId == null)
     {
         return(BadRequest());
     }
     return(Ok(_friendReviewService.GetReviewByUserForTape((int)friendId, (int)tapeId)));
 }
Пример #2
0
        public void GetReviewByUserForTape()
        {
            // arrange
            int tapeId   = 1;
            int friendId = 1;

            _friendReviewRepositoryMock.Setup(method => method.GetReviewByUserForTape(friendId, tapeId)).Returns(
                FizzWare.NBuilder.Builder <ReviewDto>
                .CreateNew()
                .With(x => x.Id          = 1).With(x => x.FriendId = friendId).With(x => x.TapeId = tapeId)
                .With(x => x.ReviewInput = "This was awesome").With(x => x.Rating = 5)
                .Build());

            // act
            var review = _friendReviewService.GetReviewByUserForTape(friendId, tapeId);

            // assert
            Assert.IsNotNull(review);
            Assert.AreEqual(1, review.FriendId);
            Assert.AreEqual(1, review.TapeId);
        }