Ejemplo n.º 1
0
        public async Task Retry_404_DoesNotRetry()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            hh.SetResponse(HttpStatusCode.NotFound);
            sut.RetryCount = 5;
            await sut.Execute(null);

            Assert.Equal(1, hh.CallsMade);
        }
Ejemplo n.º 2
0
        public async void HttpSucces_ReturnsSuccess()
        {
            var hh = new MockHttpHelper("dummy");

            hh.SetResponse(HttpStatusCode.OK);

            var f = await hh.Execute("");

            Assert.True(f.Success);
            Assert.True(f.Status == HttpStatusCode.OK);
        }
Ejemplo n.º 3
0
        public async Task Retry_500_DoesRetry()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            hh.SetResponse(HttpStatusCode.InternalServerError);

            sut.RetryCount = 5;
            await sut.Execute(null);

            Assert.Equal(5, hh.CallsMade);
        }
Ejemplo n.º 4
0
        public async void MockHelper_SetResponse_ReturnsResponse()
        {
            var hh = new MockHttpHelper("dummy");

            hh.SetResponse(HttpStatusCode.InternalServerError);

            var wcr = new WebCallRequest {
                // Normally done in the Helper but this test exercises the mock directly.
                Verb = HttpMethod.Get
            };

            var r = await hh.ActualCall_Test(wcr);

            Assert.Equal(HttpStatusCode.InternalServerError, r.Status);
        }