コード例 #1
0
        public async void IsServiceHealthyReturnTrue()
        {
            using var signalRServiceRestClient = new TestRestClientFactory(UserAgent, HttpStatusCode.OK).Create(serviceEndpoint);
            var healthApi = new HealthApi(signalRServiceRestClient);

            var operationResponse = await healthApi.GetHealthStatusWithHttpMessagesAsync();

            Assert.Equal(HttpStatusCode.OK, operationResponse.Response.StatusCode);
        }
コード例 #2
0
        [InlineData(HttpStatusCode.Conflict)]           //won't retry
        public async void IsServiceHealthyThrowException(HttpStatusCode statusCode)
        //always throw exception when status code != 200
        {
            string contentString = "response content";

            using var signalRServiceRestClient = new TestRestClientFactory(UserAgent, statusCode, contentString).Create(serviceEndpoint);
            var healthApi = new HealthApi(signalRServiceRestClient);

            HttpOperationException exception = await Assert.ThrowsAsync <HttpOperationException>(() => healthApi.GetHealthStatusWithHttpMessagesAsync());

            Assert.Equal(statusCode, exception.Response.StatusCode);
            Assert.Equal(contentString, exception.Response.Content);
        }
コード例 #3
0
ファイル: ComService.cs プロジェクト: mrpastewart/Relay
        public bool IsConnectionValid()
        {
            try
            {
                var result = HealthApi.GetApiHealth().Result;

                if (result != null && result.DatabaseOnline)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                return(false);
            }

            return(false);
        }
コード例 #4
0
 public void Init()
 {
     instance = new HealthApi();
 }
コード例 #5
0
 public HealthApiTests()
 {
     instance = new HealthApi();
 }