Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.67 KB | None | 0 0
  1. func TestCanCountTheTweetsSentByAnUser(t *testing.T) {
  2.  
  3.     // Initialization
  4.     service.InitializeService()
  5.  
  6.     var tweet, secondTweet, thirdTweet *domain.Tweet
  7.  
  8.     user := "grupoesfera"
  9.     anotherUser := "nick"
  10.     text := "This is my first tweet"
  11.     secondText := "This is my second tweet"
  12.  
  13.     tweet = domain.NewTweet(user, text)
  14.     secondTweet = domain.NewTweet(user, secondText)
  15.     thirdTweet = domain.NewTweet(anotherUser, text)
  16.  
  17.     service.PublishTweet(tweet)
  18.     service.PublishTweet(secondTweet)
  19.     service.PublishTweet(thirdTweet)
  20.  
  21.     // Operation
  22.     count := service.CountTweetsByUser(user)
  23.  
  24.     // Validation
  25.     if count != 2 {
  26.         t.Errorf("Expected count is 2 but was %d", count)
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement