Exemplo n.º 1
0
        public async Task CheckApiRateLimit()
        {
            var exception = await Record.ExceptionAsync(() => RequestEngine.CheckResponseExceptionsAsync(_apiRateLimitResponse));

            Assert.NotNull(exception);
            Assert.IsType <ApiRateLimitException>(exception);

            var ex = (ApiRateLimitException)exception;

            ex.HttpStatusCode.Should().Be((System.Net.HttpStatusCode) 429);
            ex.Message.Should().Contain("Exceeded 2 calls per second for api client. Reduce request rates to resume uninterrupted service.");
        }
Exemplo n.º 2
0
        public async Task CheckNullResponse()
        {
            var exception = await Record.ExceptionAsync(() => RequestEngine.CheckResponseExceptionsAsync(_errorResponse));

            Assert.NotNull(exception);
            Assert.IsType <BizwebSharpException>(exception);

            var ex = (BizwebSharpException)exception;

            ex.HttpStatusCode.Should().Be(System.Net.HttpStatusCode.InternalServerError);
            ex.Message.Should().Contain("Response did not indicate success. Status: 500");
        }