public IEnumerator CantResolveHost() { const string url = RequestEndpoints.FakeUrl; var request = new As <string>(new Get(new Text(url))); return(HttxTestUtils.AwaitException(request, e => { Assert.That(e, Is.Not.Null); Assert.That(e, Is.TypeOf <HttpException>()); })); }
public IEnumerator NotFound() { const string url = RequestEndpoints.NotFoundUrl; var request = new As <string>(new Get(new Text(url))); return(HttxTestUtils.AwaitException(request, e => { Assert.That(e, Is.Not.Null); Assert.That(e, Is.TypeOf <HttpException>()); var httpException = (HttpException)e; Assert.That(httpException.Code, Is.EqualTo(404)); })); }
public IEnumerator CancelException() { const string url = RequestEndpoints.TextUrl; var tokenSource = new CancellationTokenSource(); var request = new As <string>(new Get(new Cancel(new Text(url), tokenSource.Token))); tokenSource.Cancel(); return(HttxTestUtils.AwaitException(request, e => { Assert.That(e, Is.Not.Null); Assert.That(e, Is.TypeOf <OperationCanceledException>()); })); }