Esempio n. 1
0
        public ITwitterPageIterator <ITwitterResult <IIdsCursorQueryResultDTO> > GetRetweeterIdsIterator(IGetRetweeterIdsParameters parameters, ITwitterRequest request)
        {
            return(_pageCursorIteratorFactories.Create(parameters, cursor =>
            {
                var cursoredParameters = new GetRetweeterIdsParameters(parameters)
                {
                    Cursor = cursor
                };

                return _tweetQueryExecutor.GetRetweeterIds(cursoredParameters, new TwitterRequest(request));
            }));
        }
Esempio n. 2
0
        // Home Timeline

        public ITwitterPageIterator <ITwitterResult <ITweetDTO[]>, long?> GetHomeTimelineIterator(IGetHomeTimelineParameters parameters, ITwitterRequest request)
        {
            return(_pageCursorIteratorFactories.Create(parameters, cursor =>
            {
                var cursoredParameters = new GetHomeTimelineParameters(parameters)
                {
                    MaxId = cursor
                };

                return _timelineQueryExecutor.GetHomeTimeline(cursoredParameters, new TwitterRequest(request));
            }));
        }
Esempio n. 3
0
        public void GetHomeTimelineIterator_ReturnsFromPageCursorIteratorFactories()
        {
            // arrange
            var parameters = new GetHomeTimelineParameters {
                PageSize = 2
            };
            var request        = A.Fake <ITwitterRequest>();
            var expectedResult = A.Fake <ITwitterPageIterator <ITwitterResult <ITweetDTO[]>, long?> >();

            A.CallTo(() => _fakePageCursorIteratorFactories.Create(parameters, It.IsAny <Func <long?, Task <ITwitterResult <ITweetDTO[]> > > >()))
            .Returns(expectedResult);

            var controller = CreateTimelineController();
            var iterator   = controller.GetHomeTimelineIterator(parameters, request);

            // assert
            Assert.Equal(iterator, expectedResult);
        }
        public ITwitterPageIterator <ITwitterResult <ITwitterListCursorQueryResultDTO> > GetListsOwnedByUserIterator(IGetListsOwnedByUserParameters parameters, ITwitterRequest request)
        {
            return(_pageCursorIteratorFactories.Create(parameters, cursor =>
            {
                var cursoredParameters = new GetListsOwnedByAccountByUserParameters(parameters)
                {
                    Cursor = cursor
                };

                return _twitterListQueryExecutor.GetListsOwnedByUserAsync(cursoredParameters, new TwitterRequest(request));
            }));
        }