public void QueryErrorDetectionStrategyDataServiceClientExceptionTest()
        {
            HttpStatusCode[] allHttpStatusCodeValues = (HttpStatusCode[])Enum.GetValues(typeof(HttpStatusCode));

            QueryErrorDetectionStrategy strategy = new QueryErrorDetectionStrategy();

            foreach (HttpStatusCode status in allHttpStatusCodeValues)
            {
                DataServiceClientException exception = GetMockedClientException(status);

                if (strategy.IsTransient(exception))
                {
                    Assert.IsTrue(SupportedRetryableHttpStatusCodes.Contains(status), status.ToString());
                }
                else
                {
                    Assert.IsFalse(SupportedRetryableHttpStatusCodes.Contains(status), status.ToString());
                }
            }
        }
        public void QueryErrorDetectionStrategyWebExceptionTest()
        {
            WebExceptionStatus[] allWebExceptionStatusValues = (WebExceptionStatus[])Enum.GetValues(typeof(WebExceptionStatus));

            QueryErrorDetectionStrategy strategy = new QueryErrorDetectionStrategy();

            foreach (WebExceptionStatus status in allWebExceptionStatusValues)
            {
                if (status == WebExceptionStatus.ProtocolError)
                {
                    // This is covered in a separate test
                    continue;
                }

                WebException exception = new WebException("Simulated WebException with " + status.ToString(), status);

                if (strategy.IsTransient(exception))
                {
                    Assert.IsTrue(SupportedRetryableWebExceptions.Contains(exception.Status), exception.Status.ToString());
                }
                else
                {
                    Assert.IsFalse(SupportedRetryableWebExceptions.Contains(exception.Status), exception.Status.ToString());
                }
            }
        }
        public void QueryErrorDetectionStrategyTestTimeoutException()
        {
            var exception = new TimeoutException();

            bool actual = new QueryErrorDetectionStrategy().IsTransient(exception);

            Assert.IsTrue(actual);
        }
        public void QueryErrorDetectionStrategyTestIOException()
        {
            var exception = new System.IO.IOException();

            bool actual = new QueryErrorDetectionStrategy().IsTransient(exception);

            Assert.IsFalse(actual);
        }
        public void QueryErrorDetectionStrategyTestGeneralException()
        {
            bool actual = new QueryErrorDetectionStrategy().IsTransient(new Exception());

            Assert.IsFalse(actual);
        }
        public void QueryErrorDetectionStrategyTestDataServiceRequestException()
        {
            // Unfortunately this exception isn't easy to Mock with an actual error code so just
            // do a basic test
            var exception = new DataServiceRequestException("Simulated DataServiceRequestException");

            bool actual = new QueryErrorDetectionStrategy().IsTransient(exception);

            Assert.IsTrue(actual);
        }