Blog.Logic.Core.Tests.CommunityLogicTest.ShouldThrowExceptionWhenDeletingCommunityFails C# (CSharp) Method

ShouldThrowExceptionWhenDeletingCommunityFails() private method

private ShouldThrowExceptionWhenDeletingCommunityFails ( ) : void
return void
        public void ShouldThrowExceptionWhenDeletingCommunityFails()
        {
            var community = new Community { Id = 1, Name = "lorem", Description = "fudge brownies" };

            _communityRepository = new Mock<ICommunityRepository>();
            _communityRepository.Setup(a => a.Delete(It.IsAny<Community>())).Throws(new Exception("Hooha!"));
            _communityRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Community, bool>>>(), false))
                .Returns(new List<Community> { community });

            var logic = new CommunityLogic(_communityRepository.Object);

            Assert.Throws<BlogException>(() => logic.Delete(1));
        }
    }