public void AutoCompleSearch_should_be_call() { // Arrange Post post = new Post(); post.ID = 1; post.Title = "test"; List <Post> listPost = new List <Post>(); listPost.Add(post); mockPostRepository.Setup(y => y.GetAll()) .Returns(listPost.AsQueryable()); //Act List <PostDTO> result = postService.AutoCompleSearch("t"); //Assert Assert.IsType(typeof(List <PostDTO>), result); }