public ActionResult EditPost(int id) { var manager = new AdminManager(); var post = manager.GetPostByID(id); return View(post); }
public void CanGetPostById() { var manager = new AdminManager(); var post = manager.GetPostByID(1); Assert.AreEqual(post.PostID,1); }
public void CanDeletePost() { var manager = new AdminManager(); var postCount = manager.GetAllPosts().Count; var toDelete = manager.GetPostByID(postCount); manager.DeletePost(toDelete); Assert.AreEqual(postCount - 1, manager.GetAllPosts().Count); }
public void CancEditPost() { var manager = new AdminManager(); var postToEdit = manager.GetPostByID(manager.GetAllPosts().Count); postToEdit.PostTitle = "EditedPostTitle"; manager.EditPost(postToEdit); var editCheck = manager.GetPostByID(manager.GetAllPosts().Count); Assert.AreEqual(postToEdit.PostTitle,editCheck.PostTitle); }