public void CreatePost_NoContent_ShouldFail() { // arrange var postWriter = new PostWriter(_mockPostRepo.Object, _mockCommentRepo.Object, null); // act Action action = () => postWriter.CreatePost(null); // assert action.ShouldThrow <Exception>(); }
public int CreateNew(Post post, int?groupId) { return(_postWriter.CreatePost(post.Body, groupId)); }
public ActionResult Index(Post post, int?groupId) { var id = _postWriter.CreatePost(post.Body, groupId); return(RedirectToAction("Get", new { Id = id })); }