public async Task GetCommentById()
        {
            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 comment = await PageRepository.GetCommentById(firstComment.Id).ConfigureAwait(false);

            Assert.AreEqual(firstComment.Body, comment.Body);
            Assert.AreEqual(firstComment.Id, comment.Id);
        }
        public async Task DeleteComment()
        {
            var siteId = await MakeSite().ConfigureAwait(false);

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

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

            await PageRepository.DeleteComment(firstComment.Id).ConfigureAwait(false);

            var comment = await PageRepository.GetCommentById(firstComment.Id).ConfigureAwait(false);

            Assert.IsNull(comment);
        }
        public async Task GetAllComments_PageWithOneComment()
        {
            const int pageIndex = 0;
            const int pageSize  = 10;
            var       siteId    = await MakeSite().ConfigureAwait(false);

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

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

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

            Assert.AreEqual(1, comments.Count());
        }
        public async Task GetAllPendingComments()
        {
            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 secondComment = MakeComment();

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

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

            Assert.AreEqual(1, 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_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}'");
        }