Example #1
0
        public void GetStartupsOfUsersBatch_Success()
        {
            var ids = new List <int> {
                155, 160
            };                                    // investor:true
            IAngelListClient angelListClient = AngelListClient;

            var idLists = paramParser.ParseIntList(ids);

            foreach (List <int> idList in idLists)
            {
                var query = new GetUsersStartupIdsQuery(idList, angelListClient);
                Dictionary <int, List <int> > usersStartupIds = query.Execute();

                HashSet <int> uniqueStartupIds = new HashSet <int>();
                foreach (List <int> startupIds in usersStartupIds.Values)
                {
                    foreach (int startupId in startupIds)
                    {
                        uniqueStartupIds.Add(startupId);
                    }
                }

                string startupIdsString = String.Join(",", uniqueStartupIds);

                var startupsBatchCallback = new AsyncCallback(GetStartupsBatch_Success_ProcessResults);

                var startupsBatchQuery = new GetStartupsBatchQuery(uniqueStartupIds.ToList(), startupsBatchCallback, angelListClient, defaultLogWriter);

                var result = startupsBatchQuery.BeginExecute();
                result.AsyncWaitHandle.WaitOne(20 * 1000);
            }
        }
Example #2
0
        public void GetUsersStartupIdsQuery_Success()
        {
            var ids = new List <int> {
                155, 160
            };                                    // investor:true

            var query = new GetUsersStartupIdsQuery(ids, AngelListClient);
            Dictionary <int, List <int> > usersStartupIds = query.Execute();

            Assert.IsNotNull(usersStartupIds);
            Assert.AreEqual(ids.Count, usersStartupIds.Keys.Count);

            foreach (var startupIds in usersStartupIds.Values)
            {
                Assert.IsNotNull(startupIds);
                Assert.AreNotEqual(0, startupIds.Count);
            }
        }
        public void LoadUsersMarkets(List <int> userIds)
        {
            // Get startup ids for the users.
            GetUsersStartupIdsQuery startupIdsQuery = new GetUsersStartupIdsQuery(userIds, AngelListClient);
            var userIdStartupIdsDict = startupIdsQuery.Execute();

            HashSet <int> uniqueStartupIds = new HashSet <int>();

            foreach (int userId in userIdStartupIdsDict.Keys)
            {
                foreach (int startupId in userIdStartupIdsDict[userId])
                {
                    uniqueStartupIds.Add(startupId);
                }
            }

            GetStartupsMarketsQuery          startupsMarketsQuery = new GetStartupsMarketsQuery(uniqueStartupIds.ToList(), userIdStartupIdsDict, AngelListClient, defaultLogWriter);
            Dictionary <int, List <Market> > result = (Dictionary <int, List <Market> >)startupsMarketsQuery.Execute();

            ProcessStartupsMarketsQuery(result, userIdStartupIdsDict);
        }