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

ShouldThrowExceptionWhenAddingCommunityFails() private method

private ShouldThrowExceptionWhenAddingCommunityFails ( ) : void
return void
        public void ShouldThrowExceptionWhenAddingCommunityFails()
        {
            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));
        }