public void WebRequestTransientErrorDetectionStrategyDataServiceClientExceptionTest() { HttpStatusCode[] allHttpStatusCodeValues = (HttpStatusCode[])Enum.GetValues(typeof(HttpStatusCode)); WebRequestTransientErrorDetectionStrategy strategy = new WebRequestTransientErrorDetectionStrategy(); foreach (HttpStatusCode status in allHttpStatusCodeValues) { DataServiceClientException exception = QueryErrorDetectionStrategyTest.GetMockedClientException(status); Assert.IsFalse(strategy.IsTransient(exception)); } }
public void WebRequestTransientErrorDetectionStrategyWebExceptionProtocolErrorTest() { HttpStatusCode[] allHttpStatusCodeValues = (HttpStatusCode[])Enum.GetValues(typeof(HttpStatusCode)); WebRequestTransientErrorDetectionStrategy strategy = new WebRequestTransientErrorDetectionStrategy(); foreach (HttpStatusCode status in allHttpStatusCodeValues) { WebException exception = QueryErrorDetectionStrategyTest.GetMockedWebExceptionWithProtocolError(status); if (strategy.IsTransient(exception)) { Assert.IsTrue(QueryErrorDetectionStrategyTest.SupportedRetryableHttpStatusCodes.Contains(status), status.ToString()); } else { Assert.IsFalse(QueryErrorDetectionStrategyTest.SupportedRetryableHttpStatusCodes.Contains(status), status.ToString()); } } }
public void SaveChangesErrorDetectionStrategyDataServiceClientExceptionTest() { HttpStatusCode[] allHttpStatusCodeValues = (HttpStatusCode[])Enum.GetValues(typeof(HttpStatusCode)); SaveChangesErrorDetectionStrategy strategy = new SaveChangesErrorDetectionStrategy(); foreach (HttpStatusCode status in allHttpStatusCodeValues) { DataServiceClientException exception = QueryErrorDetectionStrategyTest.GetMockedClientException(status); if (strategy.IsTransient(exception)) { Assert.IsTrue(SupportedRetryableHttpStatusCodes.Contains(status), status.ToString()); } else { Assert.IsFalse(SupportedRetryableHttpStatusCodes.Contains(status), status.ToString()); } } }