Exemplo n.º 1
0
        public IEnumerable <string> Get()
        {
            ConsulHttpClient client = new ConsulHttpClient();
            string           value  = client.DoGet(serviceName, "api/Health");

            return(new string[] { value });
        }
Exemplo n.º 2
0
 public HttpTeamServiceClient(                         /*IServiceDiscovery serviceDiscovery,
                                                        * ILoadBalance loadBalance,
                                                        * IHttpClientFactory httpClientFactory,*/
     ConsulHttpClient consulHttpClient)
 {
     /*this.serviceDiscovery = serviceDiscovery;
      * this.loadBalance = loadBalance;*/
     //this.httpClientFactory = httpClientFactory;
     this.consulHttpClient = consulHttpClient;
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
 }
Exemplo n.º 6
0
 public TestController(ConsulHttpClient httpClient)
 {
     _httpClient = httpClient;
 }
Exemplo n.º 7
0
 public UsersController(ConsulHttpClient consulHttpClient)
 {
     _consulHttpClient = consulHttpClient;
 }
 public MemberServiceHttpClient(ConsulHttpClient consulHttpClient)
 {
     this._consulHttpClient = consulHttpClient;
 }
Exemplo n.º 9
0
 public BController(ILogger <BController> logger, ConsulHttpClient consulHttpClient)
 {
     _logger           = logger;
     _consulHttpClient = consulHttpClient;
 }
Exemplo n.º 10
0
 public HttpTeamServiceClient(ConsulHttpClient consulHttpClient)
 {
     this.consulHttpClient = consulHttpClient;
 }
Exemplo n.º 11
0
 public HttpMemberServiceClient(ConsulHttpClient consulHttpClient)
 {
     this.consulHttpClient = consulHttpClient;
 }
 public TeamServiceHttpClient(ConsulHttpClient consulHttpClient)
 {
     this._consulHttpClient = consulHttpClient;
 }