Esempio n. 1
0
        public void FavouriteTweetRaised()
        {
            var activityStream = CreateAccountActivityStream();

            var tweetFavoritedJson = @"{
	            ""for_user_id"": ""100"",
	            ""favorite_events"": [{
                  ""favorited_status"" : " + JsonTests.TWEET_TEST_JSON + @",
                  ""user"": " + JsonTests.USER_TEST_JSON(4242) + @"
	            }]
            }";

            var eventsReceived = new List <TweetFavoritedEvent>();

            activityStream.TweetFavorited += (sender, args) =>
            {
                eventsReceived.Add(args);
            };

            // Act
            activityStream.WebhookMessageReceived(new WebhookMessage(tweetFavoritedJson));

            // Assert
            Assert.Equal(eventsReceived.Count, 1);
            Assert.Equal(eventsReceived[0].Tweet.CreatedBy.Id, 42);
            Assert.Equal(eventsReceived[0].FavoritedBy.Id, 4242);
        }
Esempio n. 2
0
        public void UserMutedRaised_WithSourceUser()
        {
            var activityStream = CreateAccountActivityStream();

            var json = @"{
	            ""for_user_id"": ""100"",
	            ""mute_events"": [{
                  ""type"": ""mute"",
                  ""target"" : " + JsonTests.USER_TEST_JSON(ACCOUNT_ACTIVITY_USER_ID) + @",
                  ""source"": " + JsonTests.USER_TEST_JSON(41) + @"
	            }]
            }";

            var eventsReceived = new List <UserMutedEventArgs>();

            activityStream.UserMuted += (sender, args) =>
            {
                eventsReceived.Add(args);
            };

            // Act
            activityStream.WebhookMessageReceived(new WebhookMessage(json));

            // Assert
            Assert.AreEqual(eventsReceived.Count, 1);
            Assert.AreEqual(eventsReceived[0].Target.Id, 41);
        }