Exemple #1
0
        public async Task HideReview_ShouldTask()
        {
            var service = new FakeReviewService(testReviews);
            await service.HideReviewAsync(1, "");

            var targetReview = service._reviews.Find(r => r.reviewId == 1);

            Assert.IsTrue(targetReview.hidden);
        }
Exemple #2
0
        public async Task HideReview_NonExistantReview()
        {
            var service           = new FakeReviewService(testReviews);
            var reviewListBefore  = service._reviews.Where(r => r.hidden == true && r.deleted == false).ToList();
            var reviewCountBefore = reviewListBefore.Count();

            await service.HideReviewAsync(13, "");

            var reviewCountAfter = service._reviews.Where(r => r.hidden == true && r.deleted == false).Count();

            Assert.AreEqual(reviewCountBefore, reviewCountAfter);

            for (int i = 0; i < reviewCountAfter; ++i)
            {
                Assert.AreEqual(service._reviews[i].reviewId, reviewListBefore[i].reviewId);
                Assert.AreEqual(service._reviews[i].productId, reviewListBefore[i].productId);
                Assert.AreEqual(service._reviews[i].userId, reviewListBefore[i].userId);
                Assert.AreEqual(service._reviews[i].userName, reviewListBefore[i].userName);
                Assert.AreEqual(service._reviews[i].reviewRating, reviewListBefore[i].reviewRating);
            }
        }