Skip to content

Commit

Permalink
[Tests] Make the HttpClientTest.TestEscapedURI test ignore timeout (#…
Browse files Browse the repository at this point in the history
…1208)

The server used in the test sometimes cannot be reached, there's no need to
treat it as a failure. Ignore the timeout with `Assert.Ignore()` instead.
  • Loading branch information
grendello authored and jonpryor committed Jan 19, 2018
1 parent 23744be commit 196bcd8
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;

using NUnit.Framework;

Expand All @@ -19,12 +20,15 @@ public void TestUnescapedURI ()
var t = client.GetStringAsync("http://naver.com/t[e]st.txt");
t.Wait(1000);
Assert.IsNotNull(t.Result);
}
catch (AggregateException e)
{
} catch (TaskCanceledException) {
Assert.Ignore ("Connection timed out");
} catch (AggregateException e) {
Assert.AreEqual (1, e.InnerExceptions.Count);
Assert.AreEqual (typeof(HttpRequestException), e.InnerExceptions[0].GetType ());
if (e.InnerExceptions[0].GetType () == typeof (TaskCanceledException))
Assert.Ignore ("Connection timed out");
else
Assert.AreEqual (typeof(HttpRequestException), e.InnerExceptions[0].GetType ());
}
}
}
}
}

0 comments on commit 196bcd8

Please sign in to comment.