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