Blog.Logic.Core.Tests.TagsLogicTest.ShouldThrowExceptionWhenAddingTagFails C# (CSharp) 메소드

ShouldThrowExceptionWhenAddingTagFails() 개인적인 메소드

private ShouldThrowExceptionWhenAddingTagFails ( ) : void
리턴 void
        public void ShouldThrowExceptionWhenAddingTagFails()
        {
            var tag = new Common.Contracts.Tag { TagName = "foo" };
            _tagRepository = new Mock<ITagRepository>();
            _tagRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Tag, bool>>>(), null, string.Empty))
                .Throws(new Exception());

            _postRepository = new Mock<IPostRepository>();

            _tagsLogic = new TagsLogic(_tagRepository.Object, _postRepository.Object);

            Assert.Throws<BlogException>(() => _tagsLogic.Add(tag));
        }
    }