// Favorite Tweet public Task <ITwitterResult <ITweetDTO[]> > GetFavoriteTweetsAsync(IGetUserFavoriteTweetsParameters parameters, ITwitterRequest request) { var query = _tweetQueryGenerator.GetFavoriteTweetsQuery(parameters, request.ExecutionContext.TweetMode); request.Query.Url = query; request.Query.HttpMethod = HttpMethod.GET; return(_twitterAccessor.ExecuteRequestAsync <ITweetDTO[]>(request)); }
public async Task GetFavoriteTweets_ReturnsFavoritedTweetsAsync() { // Arrange var queryExecutor = CreateUserQueryExecutor(); var expectedQuery = TestHelper.GenerateString(); var parameters = new GetUserFavoriteTweetsParameters(42); var request = A.Fake <ITwitterRequest>(); var expectedResult = A.Fake <ITwitterResult <ITweetDTO[]> >(); A.CallTo(() => _fakeTweetQueryGenerator.GetFavoriteTweetsQuery(parameters, It.IsAny <TweetMode?>())).Returns(expectedQuery); A.CallTo(() => _fakeTwitterAccessor.ExecuteRequestAsync <ITweetDTO[]>(request)).Returns(expectedResult); // Act var result = await queryExecutor.GetFavoriteTweetsAsync(parameters, request); // Assert Assert.Equal(result, expectedResult); Assert.Equal(request.Query.Url, expectedQuery); Assert.Equal(HttpMethod.GET, request.Query.HttpMethod); }