public async void GetClickLikeArticleAndCommentAndDelete()// System.NotSupportedException { var result = await controller.GetAll(); var viewResult = Assert.IsType <ActionResult <List <Article> > >(result); var articleV = Assert.IsType <OkObjectResult>(viewResult.Result); var model = Assert.IsAssignableFrom <IEnumerable <Article> >(articleV.Value); Assert.Equal(2, model.Count()); foreach (var article in model) { var articlePage = await controller.ClickLike(article.Id, "article"); var articleView = Assert.IsType <OkObjectResult>(articlePage); var articleModel = Assert.IsAssignableFrom <Article>(articleView.Value); Assert.NotNull(articleModel); //Assert.NotNull(articleModel.UserCreate); Assert.NotNull(articleModel.LikeUsers); foreach (Comment comm in article.Comments) { var commentPage = await controller.ClickLike(comm.Id, "comment"); var commentView = Assert.IsType <OkObjectResult>(commentPage); var commentModel = Assert.IsAssignableFrom <Comment>(commentView.Value); Assert.NotNull(commentModel); Assert.NotNull(commentModel.UserCreate); Assert.NotNull(commentModel.LikeUsers); Assert.NotEqual(commentModel.LikeUsers.Count, 0); } foreach (Comment comm in article.Comments) { var commentPage = await controller.DeleteComment(comm.Id); //var commentView = Assert.IsType<OkObjectResult>(commentPage); //var commentModel = Assert.IsAssignableFrom<Comment>(commentView.Value); try { var commentView = Assert.IsType <ActionResult <Comment> >(commentPage); var commentV = Assert.IsType <OkObjectResult>(commentView.Result); var commentModel = Assert.IsAssignableFrom <Comment>(commentV.Value); Assert.NotNull(commentModel); Assert.NotNull(commentModel.UserCreate); Assert.NotNull(commentModel.LikeUsers); Assert.NotEqual(commentModel.LikeUsers.Count, 0); } catch (Exception e) { continue; } } } }