Blog.Logic.Core.Tests.CommentsLogicTest.ShouldGetCommentsByPost C# (CSharp) Method

ShouldGetCommentsByPost() private method

private ShouldGetCommentsByPost ( ) : void
return void
        public void ShouldGetCommentsByPost()
        {
            var expected = _comments.Where(a => a.PostId == 1).ToList();
            _commentsRepository = new Mock<ICommentRepository>();
            _commentsRepository.Setup(a => a.Find(It.IsAny<Expression<Func<Comment, bool>>>(),
                It.IsAny<Func<IQueryable<Comment>, IOrderedQueryable<Comment>>>(), It.IsAny<string>()))
                .Returns(expected);

            _userRepository = new Mock<IUserRepository>();

            _commentsLogic = new CommentsLogic(_commentsRepository.Object, _userRepository.Object);

            var results = _commentsLogic.GetByPostId(1);

            Assert.NotNull(results);
            Assert.AreEqual(3, results.Count);
            Assert.AreEqual(1, results[0].PostId);
            Assert.AreEqual(1, results[1].PostId);
            Assert.AreEqual(1, results[2].PostId);
        }