} catch (InvalidOperationException) {
}
}
+
+ [Test]
+ public void Properties_AfterClientCreation ()
+ {
+ var h = new HttpClientHandler ();
+ h.AllowAutoRedirect = true;
+
+ // We may modify properties after creating the HttpClient.
+ using (var c = new HttpClient (h, true)) {
+ h.AllowAutoRedirect = false;
+ }
+ }
+
+ [Test]
+ public void Disposed ()
+ {
+ var h = new HttpClientHandler ();
+ h.Dispose ();
+ var c = new HttpClient (h);
+ try {
+ c.GetAsync ("http://google.com").Wait ();
+ Assert.Fail ("#1");
+ } catch (AggregateException e) {
+ Assert.IsTrue (e.InnerException is ObjectDisposedException, "#2");
+ }
+ }
}
}