private ShouldThrowExceptionWhenGetTopCommentsFails ( ) : void | ||
return | void |
public void ShouldThrowExceptionWhenGetTopCommentsFails()
{
_commentsRepository = new Mock<ICommentRepository>();
_commentsRepository.Setup(a => a.GetTop(It.IsAny<Expression<Func<Comment, bool>>>(), It.IsAny<int>())).Throws(new Exception());
_userRepository = new Mock<IUserRepository>();
_commentsLogic = new CommentsLogic(_commentsRepository.Object, _userRepository.Object);
Assert.Throws<BlogException>(() => _commentsLogic.GetTopComments(2, 5));
}