void TestParsingIds(FriendshipType friendType) { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = friendType }; List <Friendship> friends = friendReqProc.ProcessResults(IdsResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var idList = friend.IDInfo; Assert.NotNull(idList); var cursor = idList.CursorMovement; Assert.NotNull(cursor); Assert.Equal("2", cursor.Previous); Assert.Equal("1", cursor.Next); var ids = idList.IDs; Assert.NotNull(ids); Assert.NotEmpty(ids); var id = ids.First(); Assert.Equal(5676142ul, id); }
void TestParsingIds(FriendshipType friendType) { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = friendType }; List<Friendship> friends = friendReqProc.ProcessResults(IdsResponse); Assert.IsNotNull(friends); Assert.IsNotNull(friends.SingleOrDefault()); var friend = friends.Single(); Assert.IsNotNull(friend); var cursor = friend.CursorMovement; Assert.IsNotNull(cursor); Assert.AreEqual(2, cursor.Previous); Assert.AreEqual(1, cursor.Next); var idList = friend.IDInfo; Assert.IsNotNull(idList); var idsCursor = idList.CursorMovement; Assert.IsNotNull(idsCursor); Assert.AreEqual(2, idsCursor.Previous); Assert.AreEqual(1, idsCursor.Next); var ids = idList.IDs; Assert.IsNotNull(ids); Assert.IsTrue(ids.Any()); var id = ids.First(); Assert.AreEqual(5676142ul, id); }
public void ProcessResults_Parses_Show_Response() { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = FriendshipType.Show }; List<Friendship> friends = friendReqProc.ProcessResults(RelationshipResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var tgtRel = friend.TargetRelationship; Assert.NotNull(tgtRel); Assert.Equal("JoeMayo", tgtRel.ScreenName); Assert.True(tgtRel.FollowedBy); Assert.Equal("15411837", tgtRel.ID); Assert.False(tgtRel.Following); var srcRel = friend.SourceRelationship; Assert.NotNull(srcRel); Assert.Equal("Linq2Tweeter", srcRel.ScreenName); Assert.True(srcRel.RetweetsWanted); Assert.False(srcRel.AllReplies); Assert.False(srcRel.MarkedSpam); Assert.False(srcRel.FollowedBy); Assert.Equal("16761255", srcRel.ID); Assert.False((bool)srcRel.Blocking); Assert.True((bool)srcRel.NotificationsEnabled); Assert.True(srcRel.Following); Assert.False(srcRel.CanDm); }
public void ProcessResults_Parses_Show_Response() { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = FriendshipType.Show }; List <Friendship> friends = friendReqProc.ProcessResults(RelationshipResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var tgtRel = friend.TargetRelationship; Assert.NotNull(tgtRel); Assert.Equal("JoeMayo", tgtRel.ScreenName); Assert.True(tgtRel.FollowedBy); Assert.Equal("15411837", tgtRel.ID); Assert.False(tgtRel.Following); var srcRel = friend.SourceRelationship; Assert.NotNull(srcRel); Assert.Equal("Linq2Tweeter", srcRel.ScreenName); Assert.True(srcRel.RetweetsWanted); Assert.False(srcRel.AllReplies); Assert.False(srcRel.MarkedSpam); Assert.False(srcRel.FollowedBy); Assert.Equal("16761255", srcRel.ID); Assert.False((bool)srcRel.Blocking); Assert.True((bool)srcRel.NotificationsEnabled); Assert.True(srcRel.Following); Assert.False(srcRel.CanDm); }
void TestParsingIds(FriendshipType friendType) { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = friendType }; List <Friendship> friends = friendReqProc.ProcessResults(IdsResponse); Assert.IsNotNull(friends); Assert.IsNotNull(friends.SingleOrDefault()); var friend = friends.Single(); Assert.IsNotNull(friend); var cursor = friend.CursorMovement; Assert.IsNotNull(cursor); Assert.AreEqual(2, cursor.Previous); Assert.AreEqual(1, cursor.Next); var idList = friend.IDInfo; Assert.IsNotNull(idList); var idsCursor = idList.CursorMovement; Assert.IsNotNull(idsCursor); Assert.AreEqual(2, idsCursor.Previous); Assert.AreEqual(1, idsCursor.Next); var ids = idList.IDs; Assert.IsNotNull(ids); Assert.IsTrue(ids.Any()); var id = ids.First(); Assert.AreEqual(5676142ul, id); }
public void ProcessResultsTest() { FriendshipRequestProcessor <Friendship> target = new FriendshipRequestProcessor <Friendship>(); XElement twitterResponse = XElement.Parse(m_testQueryResponse); bool expected = true; IList actual = target.ProcessResults(twitterResponse); var isFriend = actual.Cast <Friendship>().First().IsFriend; Assert.AreEqual(expected, actual.Cast <Friendship>().First().IsFriend); }
public void ProcessResults_Returns_Empty_Collection_When_Empty_Results() { var reqProc = new FriendshipRequestProcessor <Friendship>() { BaseUrl = "http://api.twitter.com/1/" }; List <Friendship> friendships = reqProc.ProcessResults(string.Empty); Assert.Empty(friendships); }
public void ProcessResults_Retains_Original_Input_Params() { const string SrcUsrID = "1"; const string SrcScrNm = "JoeMayo"; const string TgtUsrID = "2"; const string TgtScrNm = "MayMayo"; const int Count = 20; const string Cursor = "123"; const string ScrNm = "JoeMayo,MayMayo"; const string UsrID = "1,2"; const bool SkipStatus = true; const bool IncludeUserEntities = true; var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = FriendshipType.Lookup, SourceUserID = SrcUsrID, SourceScreenName = SrcScrNm, TargetUserID = TgtUsrID, TargetScreenName = TgtScrNm, Count = Count, Cursor = Cursor, ScreenName = ScrNm, UserID = UsrID, SkipStatus = SkipStatus, IncludeUserEntities = IncludeUserEntities }; List <Friendship> friendships = friendReqProc.ProcessResults(LookupResponse); Assert.NotNull(friendships); Assert.NotEmpty(friendships); var friendship = friendships.First(); Assert.NotNull(friendship); Assert.Equal(FriendshipType.Lookup, friendship.Type); Assert.Equal(SrcUsrID, friendship.SourceUserID); Assert.Equal(SrcScrNm, friendship.SourceScreenName); Assert.Equal(TgtUsrID, friendship.TargetUserID); Assert.Equal(TgtScrNm, friendship.TargetScreenName); Assert.Equal(Count, friendship.Count); Assert.Equal(Cursor, friendship.Cursor); Assert.Equal(ScrNm, friendship.ScreenName); Assert.Equal(UsrID, friendship.UserID); Assert.Equal(SkipStatus, friendship.SkipStatus); Assert.Equal(IncludeUserEntities, friendship.IncludeUserEntities); }
public void ProcessResults_Translates_Relationships_From_LookupQuery() { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = FriendshipType.Lookup }; List<Friendship> friends = friendReqProc.ProcessResults(LookupResponse); Assert.NotNull(friends); Assert.Single(friends); var relations = friends.Single().Relationships; Assert.NotNull(relations); Assert.Single(relations); var connections = relations.Single().Connections; Assert.NotNull(connections); Assert.Single(connections); var connection = connections.First(); Assert.NotNull(connection); Assert.Equal("following", connection); }
void TestParsingIds(FriendshipType friendType) { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = friendType }; List<Friendship> friends = friendReqProc.ProcessResults(IdsResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var idList = friend.IDInfo; Assert.NotNull(idList); var cursor = idList.CursorMovement; Assert.NotNull(cursor); Assert.Equal("2", cursor.Previous); Assert.Equal("1", cursor.Next); var ids = idList.IDs; Assert.NotNull(ids); Assert.NotEmpty(ids); var id = ids.First(); Assert.Equal(5676142ul, id); }
public void ProcessResults_Parses_FriendsListOrFollowersList_Response() { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = FriendshipType.FriendsList }; List <Friendship> friendshipList = friendReqProc.ProcessResults(FreindsFollowersResponse); Assert.NotNull(friendshipList); Assert.Single(friendshipList); var friendship = friendshipList.Single(); Assert.NotNull(friendship); var users = friendship.Users; Assert.NotNull(users); Assert.Equal(3, users.Count); var user = users.First(); Assert.NotNull(user); Assert.Equal("93604443", user.Identifier.UserID); }
public void ProcessResults_Translates_Relationships_From_LookupQuery() { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = FriendshipType.Lookup }; List <Friendship> friends = friendReqProc.ProcessResults(LookupResponse); Assert.NotNull(friends); Assert.Single(friends); var relations = friends.Single().Relationships; Assert.NotNull(relations); Assert.Single(relations); var connections = relations.Single().Connections; Assert.NotNull(connections); Assert.Single(connections); var connection = connections.First(); Assert.NotNull(connection); Assert.Equal("following", connection); }
public void ProcessResults_Parses_NoRetweetIDs_Response() { var friendReqProc = new FriendshipRequestProcessor <Friendship> { Type = FriendshipType.NoRetweetIDs }; List <Friendship> friends = friendReqProc.ProcessResults(NoRetweetIDsResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var idList = friend.IDInfo; Assert.NotNull(idList); var ids = idList.IDs; Assert.NotNull(ids); Assert.NotEmpty(ids); var id = ids.First(); Assert.Equal(15411837ul, id); }
public void ProcessResults_Retains_Original_Input_Params() { const string SrcUsrID = "1"; const string SrcScrNm = "JoeMayo"; const string TgtUsrID = "2"; const string TgtScrNm = "MayMayo"; const int Count = 20; const string Cursor = "123"; const string ScrNm = "JoeMayo,MayMayo"; const string UsrID = "1,2"; const bool SkipStatus = true; const bool IncludeUserEntities = true; var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = FriendshipType.Lookup, SourceUserID = SrcUsrID, SourceScreenName = SrcScrNm, TargetUserID = TgtUsrID, TargetScreenName = TgtScrNm, Count = Count, Cursor = Cursor, ScreenName = ScrNm, UserID = UsrID, SkipStatus = SkipStatus, IncludeUserEntities = IncludeUserEntities }; List<Friendship> friendships = friendReqProc.ProcessResults(LookupResponse); Assert.NotNull(friendships); Assert.NotEmpty(friendships); var friendship = friendships.First(); Assert.NotNull(friendship); Assert.Equal(FriendshipType.Lookup, friendship.Type); Assert.Equal(SrcUsrID, friendship.SourceUserID); Assert.Equal(SrcScrNm, friendship.SourceScreenName); Assert.Equal(TgtUsrID, friendship.TargetUserID); Assert.Equal(TgtScrNm, friendship.TargetScreenName); Assert.Equal(Count, friendship.Count); Assert.Equal(Cursor, friendship.Cursor); Assert.Equal(ScrNm, friendship.ScreenName); Assert.Equal(UsrID, friendship.UserID); Assert.Equal(SkipStatus, friendship.SkipStatus); Assert.Equal(IncludeUserEntities, friendship.IncludeUserEntities); }
public void ProcessResults_Parses_FriendsListOrFollowersList_Response() { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = FriendshipType.FriendsList }; List<Friendship> friendshipList = friendReqProc.ProcessResults(FreindsFollowersResponse); Assert.NotNull(friendshipList); Assert.Single(friendshipList); var friendship = friendshipList.Single(); Assert.NotNull(friendship); var users = friendship.Users; Assert.NotNull(users); Assert.Equal(3, users.Count); var user = users.First(); Assert.NotNull(user); Assert.Equal("93604443", user.Identifier.UserID); }
public void ProcessResults_Returns_Empty_Collection_When_Empty_Results() { var reqProc = new FriendshipRequestProcessor<Friendship>() { BaseUrl = "http://api.twitter.com/1/" }; List<Friendship> friendships = reqProc.ProcessResults(string.Empty); Assert.Empty(friendships); }
public void ProcessResults_Parses_NoRetweetIDs_Response() { var friendReqProc = new FriendshipRequestProcessor<Friendship> { Type = FriendshipType.NoRetweetIDs }; List<Friendship> friends = friendReqProc.ProcessResults(NoRetweetIDsResponse); Assert.NotNull(friends); Assert.Single(friends); var friend = friends.Single(); Assert.NotNull(friend); var idList = friend.IDInfo; Assert.NotNull(idList); var ids = idList.IDs; Assert.NotNull(ids); Assert.NotEmpty(ids); var id = ids.First(); Assert.Equal(15411837ul, id); }
public void ProcessResultsTest() { FriendshipRequestProcessor<Friendship> target = new FriendshipRequestProcessor<Friendship>(); XElement twitterResponse = XElement.Parse(m_testQueryResponse); bool expected = true; IList actual = target.ProcessResults(twitterResponse); var isFriend = actual.Cast<Friendship>().First().IsFriend; Assert.AreEqual(expected, actual.Cast<Friendship>().First().IsFriend); }