コード例 #1
0
        public async Task MyTimeoutClass_SuccessfulGet_ReturnsResult()
        {
            var stub = new SuccessHttpServiceStub();
            var my   = new MyTimeoutClass(stub);

            var result = await my.GetStringWithTimeout("http://example.com/").SingleAsync();

            Assert.AreEqual("stub", result);
        }
コード例 #2
0
        public async Task MyTimeoutClass_FailedGet_PropagatesFailure()
        {
            var stub = new SuccessHttpServiceStub();
            var my   = new MyTimeoutClass(stub);

            await ThrowsExceptionAsync <HttpRequestException>(async() =>
            {
                await my.GetStringWithTimeout("http://example.com/").SingleAsync();
            });
        }