public IActionResult Post(int post_id) { Post post = _postLogic.GetPostById(post_id); PostViewModel postModel = new PostViewModel() { Title = post.Title, Content = post.Content, PostId = post.PostId, AuraAmount = post.Aura.Amount, PostDate = post.PostDate, UserId = post.User.UserId, UserName = post.User.Name, CategoryId = post.Category.CategoryId, CategoryName = post.Category.Name, }; PostPageViewModel model = new PostPageViewModel() { Categories = _categoryLogic.GetAll() .Select(c => new CategoryViewModel { Id = c.CategoryId, Name = c.Name }).ToList(), Post = postModel, }; return(View(model)); }
public void GetPostById_Expects_True() { var returnedPost = _postLogic.GetPostById(2); Assert.AreEqual(2, returnedPost.PostId); }