Blog.Logic.Core.Tests.PostsLogicTest.ShouldThrowExceptionWhenGetPostsByTagFails C# (CSharp) 메소드

ShouldThrowExceptionWhenGetPostsByTagFails() 개인적인 메소드

private ShouldThrowExceptionWhenGetPostsByTagFails ( ) : void
리턴 void
        public void ShouldThrowExceptionWhenGetPostsByTagFails()
        {
            _postRepository = new Mock<IPostRepository>();
            _postRepository.Setup(a => a.GetPostsByTag(It.IsAny<string>(), It.IsAny<int>()))
                .Throws(new Exception());
                
            _postContentRepository = new Mock<IPostContentRepository>();
            _mediaRepository = new Mock<IMediaRepository>();

            _postsLogic = new PostsLogic(_postRepository.Object, _postContentRepository.Object,
                _mediaRepository.Object);

            Assert.Throws<BlogException>(() => _postsLogic.GetPostsByTag("lorem"));
        }
        
PostsLogicTest