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); }
public bool IsConnectionValid() { try { var result = HealthApi.GetApiHealth().Result; if (result != null && result.DatabaseOnline) { return(true); } } catch (Exception e) { return(false); } return(false); }
public void Init() { instance = new HealthApi(); }
public HealthApiTests() { instance = new HealthApi(); }