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

ShouldThrowExceptionWhenAddCommentFails() private method

private ShouldThrowExceptionWhenAddCommentFails ( ) : void
return void
        public void ShouldThrowExceptionWhenAddCommentFails()
        {
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Add(It.IsAny<Comment>())).Throws(new Exception());

            _userRepository = new Mock<IUserRepository>();

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

            Assert.Throws<BlogException>(() => _commentsLogic.Add(new Common.Contracts.Comment()));
        }