예제 #1
0
 public void UpVote_IncrementsVote()
 {
     var post = new Post(_title, _description);
     int vote = post.Vote;
     post.UpVote();
     Assert.AreEqual(vote + 1, post.Vote);
 }
예제 #2
0
 public void Edit_UpdatesTitleAndDescription()
 {
     var post = new Post(_title, _description);
     post.Edit(_newTitle, _newDescription);
     Assert.AreEqual(_newTitle, post.Title);
     Assert.AreEqual(_newDescription, post.Description);
 }
예제 #3
0
 public void Edit_SetsDateEdited()
 {
     var post = new Post(_title, _description);
     post.Edit(_newDescription);
     bool areSemiEqual = DateTimesAreSemiEqual(DateTime.Now, post.DateEdited, 1000);
     Assert.IsTrue(areSemiEqual);
 }
예제 #4
0
 public void DownVote_DecrementsVote()
 {
     var post = new Post(_title, _description);
     int vote = post.Vote;
     post.DownVote();
     Assert.AreEqual(vote - 1, post.Vote);
 }
예제 #5
0
 static void Main(string[] args)
 {
     var post = new Post("I have a question", "bla bla...");
     post.UpVote();
     post.UpVote();
     Console.WriteLine(post.DateCreated);
     Console.WriteLine(post.Vote);
     post.DownVote();
     Console.WriteLine(post.Vote);
     post.Edit("bla bla bla...");
     Console.WriteLine(post.Title + " - " + post.Description);
     Console.ReadKey();
 }
예제 #6
0
 public void Post_VoteIsInitiallyZero()
 {
     var post = new Post(_title, _description);
     Assert.AreEqual(0, post.Vote);
 }
예제 #7
0
 public void Post_Creation_SetsTitleAndDescription()
 {
     var post = new Post(_title, _description);
     Assert.AreEqual(_title, post.Title);
     Assert.AreEqual(_description, post.Description);
 }
예제 #8
0
 public void Post_Creation_SetsDateCreated()
 {
     var post = new Post(_title, _description);
     bool areSemiEqual = DateTimesAreSemiEqual(DateTime.Now, post.DateCreated, 1000);
     Assert.IsTrue(areSemiEqual);
 }