EditPost() public method

public EditPost ( Post postToUpdate, Postkey oldPostKey ) : bool
postToUpdate ForumShared.SharedDataTypes.Post
oldPostKey Postkey
return bool
Esempio n. 1
0
 public void EditPostServerTests()
 {
     DataManager target = new DataManager();
     target.CleanForumData();
     User user = new User("user", "user");
     target.AddUser(user);
     target.AddSubforum(new Subforum("subforumName"));
     Postkey pk = new Postkey("user", DateTime.Now);
     Thread.Sleep(1000);
     target.AddPost(new Post(pk, "Post", "", null, null), "subforumName");
     Post reply = new Post(new Postkey("user", DateTime.Now), "Reply", "", pk, null);
     Thread.Sleep(1000);
     reply.Body = "reply body";
     bool ans = target.AddReply(reply, pk);
     Post reply2 = new Post(new Postkey("user", DateTime.Now), "Reply2 - new Update", "", pk, null);
     reply2.Body = " reply 2 body";
     bool ans2 = target.EditPost(reply2, reply.Key);
     Assert.IsTrue(ans2); // Need to check with debugger the content of reply
     Post editedPost = target.GetPost(reply.Key);
     Assert.AreEqual(reply.Key.Time, editedPost.Key.Time);
     Assert.AreEqual(reply.Key.Username, editedPost.Key.Username);
     Assert.AreEqual(reply2.Title, editedPost.Title);
     Assert.AreEqual(reply2.Body, editedPost.Body);
     target.RemoveSubforum("subforumName");
 }