public async Task <HttpResponse> Get <T>(string slug = "", List <Query> queries = null) { var url = _urlGenerator.UrlFor <T>(slug, queries); var httpResponse = await _httpClient.Get(url, _authenticationHeaders); return(HttpResponse.Build <T>(httpResponse)); }
public async Task Put_ShouldCallPutAsyncWithHeaders() { // Arrange var url = $"{_urlGenerator.UrlFor<Group>("test_slug")}/administrators/[email protected]"; var httpContent = new StringContent(url, Encoding.UTF8, "application/json"); _httpClientMock.Setup(o => o.PutAsync(It.IsAny <string>(), It.IsAny <HttpContent>(), It.IsAny <Dictionary <string, string> >())) .ReturnsAsync(new HttpResponse(200, null, string.Empty)); // Act await _repository.Put <Group>(httpContent, ""); // Assert _httpClientMock.Verify(_ => _.PutAsync(It.IsAny <string>(), It.IsAny <HttpContent>(), It.IsAny <Dictionary <string, string> >()), Times.Once()); }
public void ItReturnsUrlForTopicRequest() { var topicSlug = "topic-slug"; var url = _urlGenerator.UrlFor <Topic>(topicSlug); url.Should().Be($"http://localhost.com/test-id/topics/{topicSlug}"); }