private ReadOnlyCollection<Domain.Model.Account> GetAccounts(SocialGraphType accountType) { ReadOnlyCollection<Domain.Model.Account> response; using (var twitterCtx = new TwitterContext(this.GetAuthKey())) { var Ids = GetIDs(twitterCtx, accountType, "-1"); response = new ReadOnlyCollection<Domain.Model.Account>(GetUsers(twitterCtx, Ids)); } return response; }
void TestQueryResponseParsesCorrectly(SocialGraphType type) { var graphReqProc = new SocialGraphRequestProcessor<SocialGraph> { Type = type }; List<SocialGraph> graphResponse = graphReqProc.ProcessResults(TestQueryResponse); Assert.NotNull(graphResponse); Assert.Single(graphResponse); var graph = graphResponse.First(); var ids = graph.IDs; Assert.NotNull(ids); Assert.Equal(ids[0], "547559234"); Assert.Equal(ids[1], "189123075"); var cursor = graph.CursorMovement; Assert.NotNull(cursor); Assert.Equal("2", cursor.Previous); Assert.Equal("3", cursor.Next); }
void TestQueryResponseParsesCorrectly(SocialGraphType type) { var graphReqProc = new SocialGraphRequestProcessor <SocialGraph> { Type = type }; List <SocialGraph> graphResponse = graphReqProc.ProcessResults(TestQueryResponse); Assert.NotNull(graphResponse); Assert.Single(graphResponse); var graph = graphResponse.First(); var ids = graph.IDs; Assert.NotNull(ids); Assert.Equal(ids[0], "547559234"); Assert.Equal(ids[1], "189123075"); var cursor = graph.CursorMovement; Assert.NotNull(cursor); Assert.Equal("2", cursor.Previous); Assert.Equal("3", cursor.Next); }
private List<String> GetIDs(TwitterContext twitterCtx, SocialGraphType apiType, string cursor) { var Ids = (from friendShip in twitterCtx.SocialGraph where friendShip.Type == apiType && friendShip.UserID == ulong.Parse(MyTwitterId) && friendShip.Count == 200 && friendShip.Cursor == cursor select friendShip).SingleOrDefault(); string nextCursor = Ids.CursorMovement.Next; var response = Ids.IDs; if (nextCursor != "0") { response.AddRange(GetIDs(twitterCtx, apiType, nextCursor)); } return response; }