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

ShouldThrowExceptionWhenUpdatingCommunityFails() private method

private ShouldThrowExceptionWhenUpdatingCommunityFails ( ) : void
return void
        public void ShouldThrowExceptionWhenUpdatingCommunityFails()
        {
            var community = new Common.Contracts.Community
                            {
                                Name = "lorem",
                                Description = "fudge brownies"
                            };

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

            var logic = new CommunityLogic(_communityRepository.Object);

            Assert.Throws<BlogException>(() => logic.Add(community));
        }