public void CallGetUserByIdMethod_WhenInputParamsAreValid()
        {
            // Arrange
            var articleServiceMock = new Mock <IArticleService>();
            var mappingServiceMock = new Mock <IMappingService>();
            var storeServiceMock   = new Mock <IStoreService>();
            var userServiceMock    = new Mock <IUserService>();
            var utilsMock          = new Mock <IUtilitiesService>();

            var controller = new ArticlesController(articleServiceMock.Object, mappingServiceMock.Object, storeServiceMock.Object, userServiceMock.Object, utilsMock.Object);

            var controllerContext = new Mock <ControllerContext>();
            var user = new Mock <IPrincipal>();

            user.Setup(p => p.IsInRole("admin")).Returns(true);
            user.SetupGet(x => x.Identity.Name).Returns("username");
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(user.Object);
            controller.ControllerContext = controllerContext.Object;

            var userModel = new User();
            var article   = new Article();
            var model     = new ArticleDetailsViewModel();

            articleServiceMock.Setup(x => x.DeleteComment(It.IsAny <string>()));
            userServiceMock.Setup(x => x.GetById(It.IsAny <string>())).Returns(userModel);
            articleServiceMock.Setup(x => x.GetArticleById(It.IsAny <Guid>())).Returns(article);
            mappingServiceMock.Setup(x => x.Map <ArticleDetailsViewModel>(article)).Returns(model);

            // Act
            controller.DeleteComment(Guid.NewGuid(), "some id");

            // Assert
            userServiceMock.Verify(x => x.GetById(It.IsAny <string>()), Times.Once);
        }
        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;
                    }
                }
            }
        }