Example #1
0
        public void TestGetAllArticlesByUser()
        {
            List <Article> articles = new List <Article>();

            articles.Add(article);
            IEnumerable <Article> _iEnumerableArticle = articles;

            mockArticleService.Setup(x => x.GetAllArticlesByUser(It.IsAny <string>(), It.IsAny <PostFilter>(), It.IsAny <int>())).Returns(_iEnumerableArticle);
            var           _articleController   = new ArticleController(mockArticleService.Object, mockPostService.Object);
            IActionResult getAllArticlesByUser = _articleController.GetAllArticlesByUser("5d247a04eff1030d7c520a111", postFilter, 4);
            var           type = getAllArticlesByUser.GetType();

            Assert.AreEqual(type.Name, "OkObjectResult");
        }