コード例 #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);
        }