[monotouch-test] Tweak DnsFailure a bit. (#5208)
* Make it clearer when a timeout happens that a timeout happened by asserting exactly that. * Don't assert after getting the (unexpected) result from the network request, since asserting will throw an exception, which will be caught and stored, and then later in the test we assert that an exception was thrown. So asserting just after a successful network request effectively hides any failures, since we're now passing because of the assertion exception. Ops.
This commit is contained in:
Родитель
1af3903f1f
Коммит
c814ddb567
|
@ -59,7 +59,6 @@ namespace MonoTests.System.Net.Http
|
||||||
HttpClient client = new HttpClient (GetHandler (handlerType));
|
HttpClient client = new HttpClient (GetHandler (handlerType));
|
||||||
var s = await client.GetStringAsync ("http://doesnotexist.xamarin.com");
|
var s = await client.GetStringAsync ("http://doesnotexist.xamarin.com");
|
||||||
Console.WriteLine (s);
|
Console.WriteLine (s);
|
||||||
Assert.Fail ($"An exception should have been thrown, instead got:\n{s}");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ex = e;
|
ex = e;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -67,6 +66,7 @@ namespace MonoTests.System.Net.Http
|
||||||
}
|
}
|
||||||
}, () => done);
|
}, () => done);
|
||||||
|
|
||||||
|
Assert.IsTrue (done, "Did not time out");
|
||||||
Assert.IsNotNull (ex, "Exception");
|
Assert.IsNotNull (ex, "Exception");
|
||||||
// The handlers throw different types of exceptions, so we can't assert much more than that something went wrong.
|
// The handlers throw different types of exceptions, so we can't assert much more than that something went wrong.
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче