Beispiel #1
0
        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>());
            }));
        }
Beispiel #2
0
        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));
            }));
        }
Beispiel #3
0
        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>());
            }));
        }