Blog.Logic.Core.Tests.PostsLogicTest.ShouldErrorWhenGetPostByIdFoundNoRecord C# (CSharp) Method

ShouldErrorWhenGetPostByIdFoundNoRecord() private method

private ShouldErrorWhenGetPostByIdFoundNoRecord ( ) : void
return void
        public void ShouldErrorWhenGetPostByIdFoundNoRecord()
        {
            _postRepository = new Mock<IPostRepository>();
            _postRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Post, bool>>>(),
                It.IsAny<Func<IQueryable<Post>, IOrderedQueryable<Post>>>(), It.IsAny<string>()))
                .Returns(new List<Post>());

            var postContents = _postContents.Where(a => a.PostId == 1).ToList();
            _postContentRepository = new Mock<IPostContentRepository>();
            _postContentRepository.Setup(a => a.Find(It.IsAny<Expression<Func<PostContent, bool>>>(), true))
                .Returns(postContents);

            _mediaRepository = new Mock<IMediaRepository>();

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

            var result = _postsLogic.GetPost(1);

            Assert.NotNull(result.Error);
            Assert.AreEqual((int)Constants.Error.RecordNotFound, result.Error.Id);
            Assert.AreEqual("Cannot find post with Id 1", result.Error.Message);
        }
PostsLogicTest