Blog.Logic.Core.Tests.CommentsLogicTest.ShouldThrowExceptionWhenGetCommentsByPostFails C# (CSharp) Method

ShouldThrowExceptionWhenGetCommentsByPostFails() private method

private ShouldThrowExceptionWhenGetCommentsByPostFails ( ) : void
return void
        public void ShouldThrowExceptionWhenGetCommentsByPostFails()
        {
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Comment, bool>>>(),
                It.IsAny<Func<IQueryable<Comment>, IOrderedQueryable<Comment>>>(), It.IsAny<string>()))
                .Throws(new Exception());

            _userRepository = new Mock<IUserRepository>();

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

            Assert.Throws<BlogException>(() => _commentsLogic.GetByPostId(1));
        }