System:
authorLawrence Pit <lawrence@mono-cvs.ximian.com>
Mon, 20 May 2002 18:49:03 +0000 (18:49 -0000)
committerLawrence Pit <lawrence@mono-cvs.ximian.com>
Mon, 20 May 2002 18:49:03 +0000 (18:49 -0000)
* AllTests.cs: added call to System.Net.Sockets.AllTests.cs

System.Net:
* ServicePointTest.cs: added
* ServicePointManagerTest.cs: added
* WebProxyTest.cs: added
* AllTests.cs: added the above tests
* WebHeaderCollection.cs: added TestIndexers.

System.Net.Sockets:
* AllTests.cs: added

svn path=/trunk/mcs/; revision=4794

mcs/class/System/Test/AllTests.cs
mcs/class/System/Test/ChangeLog
mcs/class/System/Test/System.Net.Sockets/AllTests.cs [new file with mode: 0644]
mcs/class/System/Test/System.Net.Sockets/ChangeLog [new file with mode: 0644]
mcs/class/System/Test/System.Net/AllTests.cs
mcs/class/System/Test/System.Net/ChangeLog
mcs/class/System/Test/System.Net/HttpWebRequestTest.cs [new file with mode: 0644]
mcs/class/System/Test/System.Net/ServicePointManagerTest.cs [new file with mode: 0644]
mcs/class/System/Test/System.Net/ServicePointTest.cs [new file with mode: 0644]
mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs
mcs/class/System/Test/System.Net/WebProxyTest.cs [new file with mode: 0644]

index 85c6a75dd0694a60992079da395504b02bf59374..923916f47e60faf3e743662ed8041a205ebd782d 100644 (file)
@@ -24,10 +24,8 @@ namespace MonoTests
                                suite.AddTest (System.Collections.Specialized.AllTests.Suite);\r
                                suite.AddTest (System.Diagnostics.AllTests.Suite);\r
                                 suite.AddTest (System.Net.AllTests.Suite);\r
+                                suite.AddTest (System.Net.Sockets.AllTests.Suite);\r
                                suite.AddTest (System.Text.RegularExpressions.AllTests.Suite);\r
-                               \r
-                               //suite.AddTest (System.Net.DnsTest.Suite);\r
-                               \r
                                return suite;\r
                        }\r
                }\r
index 109e34c0243320f7f373aa4e34c019d66de447c3..b0784f1ebaaf027d3bcb39eacaac1c926c7a72e6 100644 (file)
@@ -1,3 +1,7 @@
+2002/05/17  Lawrence Pit  <loz@cable.a2000.nl>
+
+       * AllTests.cs: added call to System.Net.Sockets.AllTests.cs
+
 2002/05/14  Lawrence Pit  <loz@cable.a2000.nl>
 
        * Dnstest.cs: added test for asynchronous methods
diff --git a/mcs/class/System/Test/System.Net.Sockets/AllTests.cs b/mcs/class/System/Test/System.Net.Sockets/AllTests.cs
new file mode 100644 (file)
index 0000000..fdff925
--- /dev/null
@@ -0,0 +1,33 @@
+//
+// MonoTests.System.Net.Sockets.AllTests, System.dll
+//
+// Author:
+//   Lawrence Pit <loz@cable.a2000nl>
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+        /// <summary>
+        ///   Combines all available unit tests into one test suite.
+        /// </summary>
+        public class AllTests : TestCase {
+
+                public AllTests (string name) : base (name) {}
+                
+                public static ITest Suite { 
+                        get 
+                        {
+                                TestSuite suite = new TestSuite ();
+                               #if NETWORKTEST                                                            
+                                       suite.AddTest (TcpListenerTest.Suite);
+                                       suite.AddTest (TcpClientTest.Suite);                                
+                                       //suite.AddTest (UdpClientTest.Suite);
+                               #endif                                
+                               return suite;
+                        }
+                }
+        }
+}
+
diff --git a/mcs/class/System/Test/System.Net.Sockets/ChangeLog b/mcs/class/System/Test/System.Net.Sockets/ChangeLog
new file mode 100644 (file)
index 0000000..09eef5e
--- /dev/null
@@ -0,0 +1,6 @@
+2002-05-17  Lawrence Pit <loz@cable.a2000.nl>
+
+       * AllTests.cs: added
+
+
+
index 294c292ce2d022d385a06c608fb90c0845a2b86c..ed2c8f1e78b90d23fc16843a98a604ca4b3261e5 100644 (file)
@@ -24,12 +24,21 @@ namespace MonoTests.System.Net {
                                 suite.AddTest (CookieCollectionTest.Suite);
                                 //suite.AddTest (CookieContainerTest.Suite);
                                 suite.AddTest (CredentialCacheTest.Suite);
-                                suite.AddTest (FileWebRequestTest.Suite);                                
+                                suite.AddTest (FileWebRequestTest.Suite);
                                 suite.AddTest (IPAddressTest.Suite);
                                 suite.AddTest (IPEndPointTest.Suite);
                                 suite.AddTest (SocketPermissionTest.Suite);
                                 suite.AddTest (WebHeaderCollectionTest.Suite);
+                                suite.AddTest (WebProxyTest.Suite);
                                 suite.AddTest (WebRequestTest.Suite);
+                                
+                               #if NETWORKTEST                                
+                                       suite.AddTest (DnsTest.Suite);
+                                       suite.AddTest (HttpWebRequestTest.Suite);
+                                       suite.AddTest (ServicePointTest.Suite);
+                                       suite.AddTest (ServicePointManagerTest.Suite);
+                               #endif                                
+                                
                                return suite;
                         }
                 }
index 200d3364663a23405548ebe1c965d64ed962d150..ce1eb9861b26b9449a21e14fab806738723a16c2 100644 (file)
@@ -1,3 +1,11 @@
+2002-05-20  Lawrence Pit <loz@cable.a2000.nl>
+
+       * ServicePointTest.cs: added
+       * ServicePointManagerTest.cs: added
+       * WebProxyTest.cs: added
+       * AllTests.cs: added the above tests
+       * WebHeaderCollection.cs: added TestIndexers.
+
 2002-05-19  Lawrence Pit <loz@cable.a2000.nl>
 
        * FileWebRequestTest.cs: all the async methods tests to behave the same 
diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
new file mode 100644 (file)
index 0000000..bbbba62
--- /dev/null
@@ -0,0 +1,101 @@
+//\r
+// HttpWebRequestTest.cs - NUnit Test Cases for System.Net.HttpWebRequest\r
+//\r
+// Author:\r
+//   Lawrence Pit (loz@cable.a2000.nl)\r
+//\r
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Net;\r
+using System.Collections;\r
+\r
+namespace MonoTests.System.Net\r
+{\r
+\r
+public class HttpWebRequestTest : TestCase\r
+{\r
+        public HttpWebRequestTest () :\r
+                base ("[MonoTests.System.Net.HttpWebRequestTest]") {}\r
+\r
+        public HttpWebRequestTest (string name) : base (name) {}\r
+\r
+        protected override void SetUp () {}\r
+\r
+        protected override void TearDown () {}\r
+\r
+        public static ITest Suite\r
+        {\r
+                get {\r
+                        return new TestSuite (typeof (HttpWebRequestTest));\r
+                }\r
+        }\r
+        \r
+        public void TestSync ()\r
+        {\r
+               try {\r
+                       HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
+                       req.UserAgent = "MonoClient v1.0";\r
+                       Console.WriteLine ("req:If Modified Since: " + req.IfModifiedSince);\r
+                       WriteHeaders ("req:", req.Headers);             \r
+\r
+                       HttpWebResponse res = (HttpWebResponse) req.GetResponse ();\r
+                       Console.WriteLine ("res:HttpStatusCode: " + res.StatusCode);\r
+                       Console.WriteLine ("res:HttpStatusDescription: " + res.StatusDescription);\r
+                       \r
+                       WriteHeaders ("res:", res.Headers);             \r
+                       Console.WriteLine("Last Modified: " + res.LastModified);\r
+                       \r
+                       WriteCookies ("res:", res.Cookies);\r
+                               \r
+                       WriteHeaders ("req:", req.Headers);             \r
+                               \r
+                       res.Close ();\r
+               } catch (WebException e) {\r
+                       Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);\r
+               }\r
+       }\r
+       \r
+        public void TestAsync ()\r
+        {\r
+       }\r
+       \r
+       public void TestAddRange ()\r
+       {\r
+               HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
+               req.AddRange (10);\r
+               req.AddRange (50, 90);\r
+               req.AddRange ("bytes", 100); \r
+               req.AddRange ("bytes", 100, 120);\r
+               AssertEquals ("#1", "bytes=10-,50-90,100-,100-120", req.Headers ["Range"]);\r
+               try {\r
+                       req.AddRange ("bits", 2000);\r
+                       Fail ("#2");\r
+               } catch (InvalidOperationException) {}\r
+       }\r
+       \r
+       private void WriteHeaders (string label, WebHeaderCollection col) \r
+       {\r
+               label += "Headers";\r
+               if (col.Count == 0)\r
+                       Console.WriteLine (label + "Nothing in web headers collection\n");\r
+               else\r
+                       Console.WriteLine (label);\r
+               for (int i = 0; i < col.Count; i++)\r
+                       Console.WriteLine ("\t" + col.GetKey (i) + ": " + col.Get (i));\r
+       }\r
+       \r
+       private void WriteCookies (string label, CookieCollection col) \r
+       {\r
+               label += "Cookies";\r
+               if (col.Count == 0)\r
+                       Console.WriteLine (label + "Nothing in cookies collection\n");\r
+               else\r
+                       Console.WriteLine (label);\r
+               for (int i = 0; i < col.Count; i++)\r
+                       Console.WriteLine ("\t" + col [i]);\r
+       }\r
+}\r
+\r
+}\r
+\r
diff --git a/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs b/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs
new file mode 100644 (file)
index 0000000..bfc595a
--- /dev/null
@@ -0,0 +1,113 @@
+//\r
+// ServicePointManagerTest.cs - NUnit Test Cases for System.Net.ServicePointManager\r
+//\r
+// Author:\r
+//   Lawrence Pit (loz@cable.a2000.nl)\r
+//\r
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Collections;\r
+using System.IO;\r
+using System.Net;\r
+using System.Threading;\r
+\r
+namespace MonoTests.System.Net\r
+{\r
+\r
+public class ServicePointManagerTest : TestCase\r
+{\r
+       private Uri googleUri;\r
+       private Uri yahooUri;\r
+       private Uri apacheUri;\r
+       \r
+        public ServicePointManagerTest () :\r
+                base ("[MonoTests.System.Net.ServicePointManagerTest]") {}\r
+\r
+        public ServicePointManagerTest (string name) : base (name) {}\r
+\r
+        protected override void SetUp () {\r
+               googleUri = new Uri ("http://www.google.com");\r
+               yahooUri = new Uri ("http://www.yahoo.com");\r
+               apacheUri = new Uri ("http://www.apache.org");\r
+       }\r
+\r
+        protected override void TearDown () {}\r
+\r
+        public static ITest Suite\r
+        {\r
+                get {\r
+                        return new TestSuite (typeof (ServicePointManagerTest));\r
+                }\r
+        }\r
+        \r
+        public void TestMaxServicePointManagers ()\r
+        {\r
+               try {\r
+                       AssertEquals ("#1", 0, ServicePointManager.MaxServicePoints);\r
+                       \r
+                       DoWebRequest (googleUri);\r
+                       Thread.Sleep (100);\r
+                       DoWebRequest (yahooUri);\r
+                       Thread.Sleep (100);\r
+                       DoWebRequest (apacheUri);\r
+                       Thread.Sleep (100);\r
+                       \r
+                       ServicePoint sp = ServicePointManager.FindServicePoint (googleUri);\r
+                       WriteServicePoint (sp);\r
+                       sp = ServicePointManager.FindServicePoint (yahooUri);\r
+                       WriteServicePoint (sp);\r
+                       sp = ServicePointManager.FindServicePoint (apacheUri);\r
+                       WriteServicePoint (sp);\r
+                       \r
+                       ServicePointManager.MaxServicePoints = 1;\r
+\r
+                       sp = ServicePointManager.FindServicePoint (googleUri);\r
+                       WriteServicePoint (sp);\r
+                       sp = ServicePointManager.FindServicePoint (yahooUri);\r
+                       WriteServicePoint (sp);\r
+                       sp = ServicePointManager.FindServicePoint (apacheUri);\r
+                       WriteServicePoint (sp);\r
+                       \r
+                       GC.Collect ();\r
+                       \r
+                       // hmm... aparently ms.net still has the service points even\r
+                       // though I set it to a max of 1.\r
+                       \r
+                       // this should force an exception then...               \r
+                       sp = ServicePointManager.FindServicePoint (new Uri ("http://www.microsoft.com"));\r
+                       WriteServicePoint (sp);\r
+                       \r
+               } catch (Exception e) {\r
+                       Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);\r
+               }\r
+       }\r
+       \r
+       public void TestFindServicePoint ()\r
+       {\r
+               ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));\r
+               AssertEquals ("#1", apacheUri, sp.Address);\r
+               AssertEquals ("#2", 2, sp.ConnectionLimit);\r
+               AssertEquals ("#3", "http", sp.ConnectionName);\r
+       }\r
+       \r
+       private void DoWebRequest (Uri uri)\r
+       {\r
+               WebRequest.Create (uri).GetResponse ().Close ();\r
+       }\r
+       \r
+       private void WriteServicePoint (ServicePoint sp)\r
+       {\r
+               Console.WriteLine ("\nAddress: " + sp.Address);\r
+               Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);\r
+               Console.WriteLine ("ConnectionName: " + sp.ConnectionName);\r
+               Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);\r
+               Console.WriteLine ("IdleSince: " + sp.IdleSince);\r
+               Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);\r
+               Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);\r
+               Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);             \r
+       }\r
+}\r
+\r
+}\r
+\r
diff --git a/mcs/class/System/Test/System.Net/ServicePointTest.cs b/mcs/class/System/Test/System.Net/ServicePointTest.cs
new file mode 100644 (file)
index 0000000..92290f1
--- /dev/null
@@ -0,0 +1,171 @@
+//\r
+// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint\r
+//\r
+// Author:\r
+//   Lawrence Pit (loz@cable.a2000.nl)\r
+//\r
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Collections;\r
+using System.IO;\r
+using System.Net;\r
+using System.Threading;\r
+\r
+namespace MonoTests.System.Net\r
+{\r
+\r
+public class ServicePointTest : TestCase\r
+{\r
+        public ServicePointTest () :\r
+                base ("[MonoTests.System.Net.ServicePointTest]") {}\r
+\r
+        public ServicePointTest (string name) : base (name) {}\r
+\r
+        protected override void SetUp () {}\r
+\r
+        protected override void TearDown () {}\r
+\r
+        public static ITest Suite\r
+        {\r
+                get {\r
+                        return new TestSuite (typeof (ServicePointTest));\r
+                }\r
+        }\r
+        \r
+        public void TestAll ()\r
+        {\r
+               try {\r
+                       ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));\r
+                       WriteServicePoint ("A servicepoint that isn't really", p);                      \r
+                       \r
+                       ServicePointManager.MaxServicePoints = 2;\r
+                       ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));\r
+                       try {                   \r
+                               ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));\r
+                               Fail ("#1");\r
+                       } catch (InvalidOperationException) { }\r
+                       ServicePointManager.MaxServicePoints = 0;\r
+                       \r
+                       WriteServicePoint ("google before getting a webrequest", google);\r
+                       \r
+                       HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
+                       HttpWebResponse res = (HttpWebResponse) req.GetResponse ();                     \r
+                       \r
+                       WriteServicePoint ("google after getting a response", google);\r
+                       ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));\r
+                       AssertEquals ("#equals", google, google2);\r
+                       res.Close ();\r
+                       \r
+                       // in both instances property CurrentConnections is 0 according to ms.net.\r
+                       // let's see what it says when we do async operations...\r
+                       \r
+                       HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
+                       req2.Method = "PUT";\r
+                       IAsyncResult async = req2.BeginGetRequestStream (null, null);\r
+                       WriteServicePoint ("after async BeginGetRequestStream", google);\r
+                       // CurrentConnections: 1\r
+                       Stream stream2 = req2.EndGetRequestStream (async);\r
+                       WriteServicePoint ("after async EndGetRequestStream", google);\r
+                       // CurrentConnections: 1\r
+                       stream2.Close ();\r
+                       \r
+                       req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
+                       async = req2.BeginGetResponse (null, null);\r
+                       WriteServicePoint ("after async BeginGetResponse", google);\r
+                       // CurrentConnections: 2\r
+                       WebResponse res2 = req2.EndGetResponse (async);\r
+                       WriteServicePoint ("after async EndGetResponse", google);\r
+                       // CurrentConnections: 0                        \r
+                       // curious that after you get the webresponse object CurrentConnections is set to 0.\r
+                       // you'd think that you'd still be connected until you close the webresponse..\r
+                       Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
+                       res2.Close ();\r
+                       \r
+                       \r
+                       // unless of course some buffering is taking place.. let's check\r
+                       Uri uri2 = new Uri ("http://www.apache.org/dist/httpd/httpd-2.0.36.tar.gz");\r
+                       ServicePoint sp2 = ServicePointManager.FindServicePoint (uri2);\r
+                       req2 = (HttpWebRequest) WebRequest.Create (uri2);\r
+                       async = req2.BeginGetResponse (null, null);\r
+                       WriteServicePoint ("Large file: after async BeginGetResponse", sp2);\r
+                       // CurrentConnections: 1\r
+                       res2 = req2.EndGetResponse (async);\r
+                       WriteServicePoint ("Large file: after async EndGetResponse", sp2);\r
+                       // CurrentConnections: 1\r
+                       // and so it shows\r
+                       Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
+                       res2.Close ();\r
+                       \r
+                       \r
+                       // what's the limit of the cache?\r
+                       req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");\r
+                       res2 = req2.GetResponse ();\r
+                       sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));\r
+                       WriteServicePoint ("apache", sp2);\r
+                       Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
+                       // CurrentConnections: 1\r
+                       res2.Close ();\r
+                       // curious other effect: address is actually the full Uri of the previous request\r
+                       // anyways, buffer is probably 4096 bytes\r
+\r
+                       \r
+               } catch (WebException e) {\r
+                       Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);\r
+               }\r
+       }\r
+\r
+       // try getting the stream to 5 web response objects     \r
+       // while ConnectionLimit equals 2\r
+       /*\r
+       public void TestConnectionLimit ()\r
+       {               \r
+               try {\r
+                       // the default is already 2, just in case it isn't..\r
+                       ServicePointManager.DefaultConnectionLimit = 2;\r
+                       \r
+                       Uri uri = new Uri ("http://www.apache.org/dist/httpd/httpd-2.0.36.tar.gz");\r
+                       ServicePoint sp = ServicePointManager.FindServicePoint (uri);                   \r
+                       WebResponse [] res = new WebResponse [5];\r
+                       for (int i = 0; i < 5; i++) {\r
+                               Console.WriteLine ("GOT1 : " + i);\r
+                               HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);\r
+                               Console.WriteLine ("GOT2 : " + i);\r
+                               res [i] = req.GetResponse ();\r
+                               WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);\r
+                       }\r
+                       \r
+                       for (int i = 0; i < 5; i++) {\r
+                               Stream stream = res [i].GetResponseStream();\r
+                               Console.WriteLine ("Reading stream: " + i + " : " + stream);\r
+                               int len = 0;\r
+                               while (stream.ReadByte () != -1)\r
+                                       len++;\r
+                               Console.WriteLine ("Finished reading: " + len + " bytes");\r
+                       }\r
+                       \r
+                       for (int i = 0; i < 5; i++) {\r
+                               res [i].Close ();\r
+                       }\r
+               } catch (WebException e) {\r
+                       Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);\r
+               }               \r
+       }\r
+       */\r
+       \r
+       private void WriteServicePoint (string label, ServicePoint sp)\r
+       {\r
+               Console.WriteLine ("\n" + label);\r
+               Console.WriteLine ("Address: " + sp.Address);\r
+               Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);\r
+               Console.WriteLine ("ConnectionName: " + sp.ConnectionName);\r
+               Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);\r
+               Console.WriteLine ("IdleSince: " + sp.IdleSince);\r
+               Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);\r
+               Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);\r
+               Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);             \r
+       }\r
+}\r
+\r
+}\r
+\r
index 9db0e0521db4ea5c1641622bf300a55bb11edf39..32d22cb30f353d9a9ebd5e612b1c7631c8611bf3 100644 (file)
@@ -158,6 +158,13 @@ public class WebHeaderCollectionTest : TestCase
                AssertEquals ("#15", null, w.GetValues ("NotExistent"));\r
        }\r
        \r
+       public void TestIndexers ()\r
+       {\r
+               AssertEquals ("#1", "Value1", col [0]);\r
+               AssertEquals ("#2", "Value1", col ["Name1"]);\r
+               AssertEquals ("#3", "Value1", col ["NAME1"]);\r
+       }\r
+       \r
        public void TestRemove ()\r
        {\r
                col.Remove ("Name1");\r
diff --git a/mcs/class/System/Test/System.Net/WebProxyTest.cs b/mcs/class/System/Test/System.Net/WebProxyTest.cs
new file mode 100644 (file)
index 0000000..c6c1ec0
--- /dev/null
@@ -0,0 +1,94 @@
+//\r
+// WebProxyTest.cs - NUnit Test Cases for System.Net.WebProxy\r
+//\r
+// Author:\r
+//   Lawrence Pit (loz@cable.a2000.nl)\r
+//\r
+\r
+using NUnit.Framework;\r
+using System;\r
+using System.Collections;\r
+using System.IO;\r
+using System.Net;\r
+using System.Threading;\r
+\r
+namespace MonoTests.System.Net\r
+{\r
+\r
+public class WebProxyTest : TestCase\r
+{\r
+       private Uri googleUri;\r
+       private Uri yahooUri;\r
+       private Uri apacheUri;\r
+       \r
+        public WebProxyTest () :\r
+                base ("[MonoTests.System.Net.WebProxyTest]") {}\r
+\r
+        public WebProxyTest (string name) : base (name) {}\r
+\r
+        protected override void SetUp () {\r
+               googleUri = new Uri ("http://www.google.com");\r
+               yahooUri = new Uri ("http://www.yahoo.com");\r
+               apacheUri = new Uri ("http://www.apache.org");\r
+       }\r
+\r
+        protected override void TearDown () {}\r
+\r
+        public static ITest Suite\r
+        {\r
+                get {\r
+                        return new TestSuite (typeof (WebProxyTest));\r
+                }\r
+        }\r
+        \r
+        public void TestConstructors ()\r
+        {\r
+               WebProxy p = new WebProxy ();\r
+               Assert("#1", p.Address == null);\r
+               AssertEquals ("#2", 0, p.BypassArrayList.Count);\r
+               AssertEquals ("#3", 0, p.BypassList.Length);\r
+               AssertEquals ("#4", false, p.BypassProxyOnLocal);\r
+               try {\r
+                       p.BypassList = null;\r
+                       Fail ("#5 not spec'd, but should follow ms.net implementation");\r
+               } catch (ArgumentNullException) {}\r
+       }\r
+       \r
+       public void TestGetProxy ()\r
+       {\r
+       }       \r
+       \r
+       public void TestIsByPassed ()\r
+       {\r
+               WebProxy p = new WebProxy ("http://proxy.contoso.com", true);\r
+               Assert ("#1", !p.IsBypassed (new Uri ("http://www.google.com")));\r
+               Assert ("#2", p.IsBypassed (new Uri ("http://localhost/index.html")));\r
+               Assert ("#3", p.IsBypassed (new Uri ("http://localhost:8080/index.html")));\r
+               Assert ("#4", p.IsBypassed (new Uri ("http://loopback:8080/index.html")));\r
+               Assert ("#5", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")));\r
+               Assert ("#6", p.IsBypassed (new Uri ("http://webserver/index.html")));\r
+               Assert ("#7", !p.IsBypassed (new Uri ("http://webserver.com/index.html")));\r
+               try {\r
+                       p.IsBypassed (null);\r
+                       Fail ("#8 not spec'd, but should follow ms.net implementation");\r
+               } catch (NullReferenceException) {}\r
+               \r
+               p = new WebProxy ("http://proxy.contoso.com", false);\r
+               Assert ("#11", !p.IsBypassed (new Uri ("http://www.google.com")));\r
+               Assert ("#12: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost/index.html")));\r
+               Assert ("#13: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost:8080/index.html")));\r
+               Assert ("#14: lamespec of ms.net", p.IsBypassed (new Uri ("http://loopback:8080/index.html")));\r
+               Assert ("#15: lamespec of ms.net", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")));\r
+               Assert ("#16", !p.IsBypassed (new Uri ("http://webserver/index.html")));\r
+               \r
+               p.BypassList = new string [] { "google.com", "contoso.com" };\r
+               Assert ("#20", p.IsBypassed (new Uri ("http://www.google.com")));\r
+               Assert ("#21", p.IsBypassed (new Uri ("http://www.GOOGLE.com")));\r
+               Assert ("#22", p.IsBypassed (new Uri ("http://www.contoso.com:8080/foo/bar/index.html")));\r
+               Assert ("#23", !p.IsBypassed (new Uri ("http://www.contoso2.com:8080/foo/bar/index.html")));\r
+               Assert ("#24", !p.IsBypassed (new Uri ("http://www.foo.com:8080/contoso.com.html")));\r
+       }\r
+}\r
+\r
+}\r
+\r