Merge pull request #2073 from BrzVlad/fix-sgen
[mono.git] / mcs / class / System.Net.Http / Test / System.Net.Http / HttpClientHandlerTest.cs
index 202fb747b6ceb67b4243247395ee8acb06b9bb5c..78f8a0c225d5eb089658e94aa3aa821bc1706f42 100644 (file)
@@ -105,5 +105,31 @@ namespace MonoTests.System.Net.Http
                        } 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");
+                       }
+               }
        }
 }