public void ShouldReturnFalseWhenDeleteCommentFoundNoRecord()
        {
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Comment, bool>>>(), false))
               .Returns(new List<Comment>());

            _userRepository = new Mock<IUserRepository>();

            _commentsLogic = new CommentsLogic(_commentsRepository.Object, _userRepository.Object);

            var result = _commentsLogic.Delete(1);

            Assert.IsFalse(result);
        }
        public void ShouldThrowExceptionWhenDeleteCommentFails()
        {
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Delete(It.IsAny<Comment>())).Throws(new Exception());

            _userRepository = new Mock<IUserRepository>();

            _commentsLogic = new CommentsLogic(_commentsRepository.Object, _userRepository.Object);

            Assert.Throws<BlogException>(() => _commentsLogic.Delete(1));
        }
        public void ShouldReturnTrueOnDeleteComment()
        {
            var dbResult = new List<Comment> { new Comment { CommentId = 1 } };
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Comment, bool>>>(), false))
               .Returns(dbResult);

            _userRepository = new Mock<IUserRepository>();

            _commentsLogic = new CommentsLogic(_commentsRepository.Object, _userRepository.Object);

            var result = _commentsLogic.Delete(1);

            Assert.IsTrue(result);
        }