public async Task GetRelationshipBetween_ReturnsFromUserQueryExecutor() { // Arrange var controller = CreateUserController(); var parameters = new GetRelationshipBetweenParameters(42, 43); var request = A.Fake <ITwitterRequest>(); var expectedResult = A.Fake <ITwitterResult <IRelationshipDetailsDTO> >(); A.CallTo(() => _fakeUserQueryExecutor.GetRelationshipBetween(parameters, request)).Returns(expectedResult); // Act var result = await controller.GetRelationshipBetween(parameters, request); // Assert Assert.Equal(result, expectedResult); }
public void GetRelationshipBetween_ReturnsExpectedQuery() { // Arrange var parameters = new GetRelationshipBetweenParameters(42, 43) { CustomQueryParameters = { new Tuple <string, string>("hello", "world") } }; var queryGenerator = CreateUserQueryGenerator(); // Act var result = queryGenerator.GetRelationshipBetweenQuery(parameters); // Assert Assert.Equal(result, $"https://api.twitter.com/1.1/friendships/show.json?source_id=42&target_id=43&hello=world"); }
public async Task GetRelationshipBetween_ReturnsRelationshipDTOAsync() { // Arrange var queryExecutor = CreateUserQueryExecutor(); var request = A.Fake <ITwitterRequest>(); var url = TestHelper.GenerateString(); var parameter = new GetRelationshipBetweenParameters(42, 43); var expectedResult = A.Fake <ITwitterResult <IRelationshipDetailsDTO> >(); A.CallTo(() => _fakeUserQueryGenerator.GetRelationshipBetweenQuery(parameter)).Returns(url); A.CallTo(() => _fakeTwitterAccessor.ExecuteRequestAsync <IRelationshipDetailsDTO>(request)).Returns(expectedResult); // Act var result = await queryExecutor.GetRelationshipBetweenAsync(parameter, request); // Assert Assert.Equal(result, expectedResult); Assert.Equal(request.Query.Url, url); Assert.Equal(HttpMethod.GET, request.Query.HttpMethod); }