private void Search(ITwitterWrapper twitterWrapper, string keywords) { var searchResult = twitterWrapper.FindByKeywords(keywords); lock (this) { Interlocked.Decrement(ref asychronousSearchesInProgress); foundUsers = foundUsers.Union(searchResult); } if(asychronousSearchesInProgress == 0) OnSearchCompleted(new SearchCompletedEventArgs(foundUsers)); }
private void StartSearching(ITwitterWrapper twitterWrapper, string keywords) { SearchExecutor.Execute(() => Search(twitterWrapper, keywords)); }
public void SetUp() { twitterWrapper = MockRepository.GenerateStub<ITwitterWrapper>(); twitterWrapper.Stub(x => x.FindByKeywords(Arg<string>.Is.Anything)).Return(new List<int> { 1, 2 }); executor = new MultipleThreadsExecutor(); }
public UsersByKeywordsSearcher(ITwitterWrapper twitterWrapper, ISearchExecutor searchExecutor) { TwitterWrapper = twitterWrapper; SearchExecutor = searchExecutor; }
public MakingFriendsService(ITwitterWrapper twitterWrapper) { TwitterWrapper = twitterWrapper; }