public IEnumerable <string> Get() { ConsulHttpClient client = new ConsulHttpClient(); string value = client.DoGet(serviceName, "api/Health"); return(new string[] { value }); }
public HttpTeamServiceClient( /*IServiceDiscovery serviceDiscovery, * ILoadBalance loadBalance, * IHttpClientFactory httpClientFactory,*/ ConsulHttpClient consulHttpClient) { /*this.serviceDiscovery = serviceDiscovery; * this.loadBalance = loadBalance;*/ //this.httpClientFactory = httpClientFactory; this.consulHttpClient = consulHttpClient; }
public async Task DeleteRecurseAsync_should_accept_a_success_StatusCode(HttpStatusCode httpStatusCode) { // Arrange var clientMock = new Mock <HttpClient>(); clientMock.Setup(x => x.SendAsync(It.IsAny <HttpRequestMessage>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new HttpResponseMessage { StatusCode = httpStatusCode }); var sut = new ConsulHttpClient(clientMock.Object, _options); // Act & Assert await sut.DeleteRecurseAsync(_endpoint); }
public async Task PutStringAsync_should_throw_HttpException_when_receive_a_non_success_StatusCode(HttpStatusCode httpStatusCode) { // Arrange var clientMock = new Mock <HttpClient>(); clientMock.Setup(x => x.SendAsync(It.IsAny <HttpRequestMessage>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new HttpResponseMessage { StatusCode = httpStatusCode }); var sut = new ConsulHttpClient(clientMock.Object, _options); // Assert await Assert.ThrowsAsync <HttpRequestException>(async() => { // Act await sut.PutStringAsync(_endpoint, _value); }); }
public HttpServiceClient(ConsulHttpClient consulHttpClient) { _consulHttpClient = consulHttpClient; }
public TestController(ConsulHttpClient httpClient) { _httpClient = httpClient; }
public UsersController(ConsulHttpClient consulHttpClient) { _consulHttpClient = consulHttpClient; }
public MemberServiceHttpClient(ConsulHttpClient consulHttpClient) { this._consulHttpClient = consulHttpClient; }
public BController(ILogger <BController> logger, ConsulHttpClient consulHttpClient) { _logger = logger; _consulHttpClient = consulHttpClient; }
public HttpTeamServiceClient(ConsulHttpClient consulHttpClient) { this.consulHttpClient = consulHttpClient; }
public HttpMemberServiceClient(ConsulHttpClient consulHttpClient) { this.consulHttpClient = consulHttpClient; }
public TeamServiceHttpClient(ConsulHttpClient consulHttpClient) { this._consulHttpClient = consulHttpClient; }