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);
        }
        [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);
        }
Exemple #3
0
        public bool IsConnectionValid()
        {
            try
            {
                var result = HealthApi.GetApiHealth().Result;

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

            return(false);
        }
Exemple #4
0
 public void Init()
 {
     instance = new HealthApi();
 }
Exemple #5
0
 public HealthApiTests()
 {
     instance = new HealthApi();
 }