Example #1
0
            public TestHarness WebSiteThrowsWebException(HttpStatusCode statusCode)
            {
                _mockWebClient
                .Stub(x =>
                      x.GetHtmlAsync(
                          Arg.Is(_fakeUrl),
                          Arg <CancellationToken> .Is.Anything))
                .Throw(WebExceptionHelper.CreateWebExceptionWithStatusCode(statusCode));

                return(this);
            }
Example #2
0
        public IEnumerable InvokesRetryPolicyExceptions()
        {
            yield return(new object[]
            {
                new Exception("General Exception should be retried"),
                true
            });

            yield return(new object[]
            {
                WebExceptionHelper.CreateWebExceptionWithStatusCode(HttpStatusCode.InternalServerError),
                // retry on a 500
                true
            });

            yield return(new object[]
            {
                WebExceptionHelper.CreateWebExceptionWithStatusCode(HttpStatusCode.NotFound),
                // do not retry on 404
                false
            });
        }