Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public async Task GetCommentById_RandomId()
        {
            var comment = await PageRepository.GetCommentById(Guid.NewGuid()).ConfigureAwait(false);

            Assert.IsNull(comment);
        }
Ejemplo n.º 4
0
        public void GetCommentById_GuidEmpty()
        {
            var ex = Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => PageRepository.GetCommentById(Guid.Empty));

            Assert.AreEqual("Must not be Guid.Empty [Code 210110-1823] (Parameter 'commentId')", ex.Message);
        }