public void ShouldAddCommentLikeWhenCommentNotYetLikedByUser()
{
var commentLike = new CommentLike
{
CommentLikeId = 4,
CommentId = 1,
UserId = 1,
User = new User
{
UserId = 1,
UserName = "FooBar"
}
};
_commentLikeRepository = new Mock<ICommentLikeRepository>();
_commentLikeRepository.Setup(a => a.Find(It.IsAny<Expression<Func<CommentLike, bool>>>(), false))
.Returns(new List<CommentLike>());
_commentLikeRepository.Setup(a => a.Add(It.IsAny<CommentLike>()))
.Returns(commentLike);
_commentLikesLogic = new CommentLikesLogic(_commentLikeRepository.Object);
var result = _commentLikesLogic.Add(new Common.Contracts.CommentLike
{
CommentId = 1,
UserId = 1
});
Assert.NotNull(result);
Assert.AreEqual(4, result.CommentLikeId);
}