Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }