Пример #1
0
        public IEnumerable <string> Get()
        {
            ConsulHttpClient client = new ConsulHttpClient();
            string           value  = client.DoGet(serviceName, "api/Health");

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