public IActionResult GetReviewsByUserForAllTapes(int?friendId) { if (friendId == null) { return(BadRequest()); } return(Ok(_friendReviewService.GetReviewByUserForAllTapes((int)friendId))); }
public void GetReviewsByUserForAllTapes() { // arrange int friendId = 1; _friendReviewRepositoryMock.Setup(method => method.GetReviewByUserForAllTapes(friendId)).Returns( FizzWare.NBuilder.Builder <ReviewDto> .CreateListOfSize(2) .TheFirst(1).With(x => x.Id = 1).With(x => x.FriendId = friendId).With(x => x.TapeId = 1) .With(x => x.ReviewInput = "This was awesome").With(x => x.Rating = 5) .TheNext(1).With(x => x.Id = 2).With(x => x.FriendId = friendId).With(x => x.TapeId = 2) .With(x => x.ReviewInput = "This was terrible").With(x => x.Rating = 1) .Build()); // act var reviews = _friendReviewService.GetReviewByUserForAllTapes(friendId); // assert Assert.IsNotNull(reviews); Assert.AreEqual(2, reviews.Count()); Assert.AreNotEqual(3, reviews.Count()); }