public async Task GetAllComments_RandomPageId()
        {
            const int pageIndex    = 0;
            const int pageSize     = 10;
            var       randomPageId = Guid.NewGuid();
            var       comments     = await PageRepository.GetAllComments(randomPageId, false, pageIndex, pageSize).ConfigureAwait(false);

            Assert.AreEqual(0, comments.Count());
        }
        public async Task GetAllComments()
        {
            const int pageIndex = 0;
            const int pageSize  = 10;
            var       siteId    = await MakeSite().ConfigureAwait(false);

            var firstPage = await MakePage(siteId).ConfigureAwait(false);

            var comments = await PageRepository.GetAllComments(firstPage.Id, false, pageIndex, pageSize).ConfigureAwait(false);

            Assert.AreEqual(0, comments.Count());
        }
        public async Task GetAllComments_WithPaging()
        {
            const int pageSize = 5;
            var       siteId   = await MakeSite().ConfigureAwait(false);

            var firstPage = await MakePage(siteId).ConfigureAwait(false);

            for (var i = 0; i < 10; i++)
            {
                var firstComment = MakeComment();
                await PageRepository.SaveComment(firstPage.Id, firstComment).ConfigureAwait(false);
            }
            var firstPageWithComments = await PageRepository.GetAllComments(firstPage.Id, false, 0, pageSize).ConfigureAwait(false);

            var secondPageWithComments = await PageRepository.GetAllComments(firstPage.Id, false, 1, pageSize).ConfigureAwait(false);

            Assert.AreEqual(5, firstPageWithComments.Count());
            Assert.AreEqual(5, secondPageWithComments.Count());
            Assert.AreEqual(0, firstPageWithComments.Intersect(secondPageWithComments, new CommentComparer()).Count());
        }
        public async Task GetAllComments_2PagesWithComment()
        {
            const int pageIndex = 0;
            const int pageSize  = 10;
            var       siteId    = await MakeSite().ConfigureAwait(false);

            var firstPage = await MakePage(siteId).ConfigureAwait(false);

            var firstComment = MakeComment();
            await PageRepository.SaveComment(firstPage.Id, firstComment).ConfigureAwait(false);

            var secondPage = await MakePage(siteId).ConfigureAwait(false);

            var secondComment = MakeComment();
            await PageRepository.SaveComment(secondPage.Id, secondComment).ConfigureAwait(false);

            var comments = await PageRepository.GetAllComments(secondPage.Id, false, pageIndex, pageSize).ConfigureAwait(false);

            Assert.AreEqual(1, comments.Count());
        }
        public async Task GetAllComments_ForAllPages()
        {
            const int pageIndex = 0;
            const int pageSize  = int.MaxValue;
            var       siteId    = await MakeSite().ConfigureAwait(false);

            var firstPage = await MakePage(siteId).ConfigureAwait(false);

            var firstComment = MakeComment();
            await PageRepository.SaveComment(firstPage.Id, firstComment).ConfigureAwait(false);

            var secondPage = await MakePage(siteId).ConfigureAwait(false);

            var secondComment = MakeComment();
            await PageRepository.SaveComment(secondPage.Id, secondComment).ConfigureAwait(false);

            var comments = await PageRepository.GetAllComments(null, false, pageIndex, pageSize).ConfigureAwait(false);

            Assert.AreEqual(1, comments.Count(p => p.Author == firstComment.Author), $"Author is '{firstComment.Author}'");
            Assert.AreEqual(1, comments.Count(p => p.Author == secondComment.Author), $"Author is '{secondComment.Author}'");
        }
        public async Task GetAllComments_ApprovedOnly()
        {
            const int pageIndex = 0;
            const int pageSize  = 10;
            var       siteId    = await MakeSite().ConfigureAwait(false);

            var firstPage = await MakePage(siteId).ConfigureAwait(false);

            var firstComment = MakeComment();

            firstComment.IsApproved = true;
            await PageRepository.SaveComment(firstPage.Id, firstComment).ConfigureAwait(false);

            var secondComment = MakeComment();

            secondComment.IsApproved = false;
            await PageRepository.SaveComment(firstPage.Id, secondComment).ConfigureAwait(false);

            var comments = await PageRepository.GetAllComments(firstPage.Id, true, pageIndex, pageSize).ConfigureAwait(false);

            Assert.AreEqual(1, comments.Count());
        }