public async Task <IActionResult> Index() { HomeViewModel model = new HomeViewModel(); if (User.Identity.IsAuthenticated) { model.Posts = await _postsApprovalFlowService.GetPostsByStatus(null); } else { model.Posts = await _postsApprovalFlowService.GetPostsByStatus(PostStatusEnum.Published.GetHashCode()); } return(View(model)); }
public async Task GetApprovedPosts() { Post post = new Post("Test 1", "Lorem ipsum dolor amet....", "user"); await _postsApprovalFlowService.AddPost(post); //Approve post post.UpdatePostStatus(Domain.Enum.PostStatusEnum.Published, "editor"); var posts = await _postsApprovalFlowService.GetPostsByStatus(PostStatusEnum.Published.GetHashCode()); Assert.IsTrue(posts.Count > 0); }