Example #1
0
        // FRIENDSHIPS
        public Task <ITwitterResult <IRelationshipStateDTO[]> > GetRelationshipsWith(IGetRelationshipsWithParameters parameters, ITwitterRequest request)
        {
            var query = _userQueryGenerator.GetRelationshipsWithQuery(parameters);

            request.Query.Url        = query;
            request.Query.HttpMethod = HttpMethod.GET;
            return(_twitterAccessor.ExecuteRequest <IRelationshipStateDTO[]>(request));
        }
Example #2
0
        public async Task GetRelationshipsWith_ReturnsRelationshipsAsync()
        {
            // Arrange
            var queryExecutor = CreateUserQueryExecutor();
            var parameters    = new GetRelationshipsWithParameters(new long[] { 42 });

            var url            = TestHelper.GenerateString();
            var request        = A.Fake <ITwitterRequest>();
            var expectedResult = A.Fake <ITwitterResult <IRelationshipStateDTO[]> >();

            A.CallTo(() => _fakeUserQueryGenerator.GetRelationshipsWithQuery(parameters)).Returns(url);
            A.CallTo(() => _fakeTwitterAccessor.ExecuteRequestAsync <IRelationshipStateDTO[]>(request)).Returns(expectedResult);

            // Act
            var result = await queryExecutor.GetRelationshipsWithAsync(parameters, request);

            // Assert
            Assert.Equal(result, expectedResult);
            Assert.Equal(request.Query.Url, url);
            Assert.Equal(HttpMethod.GET, request.Query.HttpMethod);
        }