Merge pull request #260 from pcc/topmost
[mono.git] / mcs / class / System / Test / System.Net / DnsTest.cs
index 2bfce6a3b94dda97155619afe7605bb735da9298..44797640651c31745e21743823130c9c33b91ec3 100644 (file)
@@ -28,12 +28,12 @@ namespace MonoTests.System.Net
        [TestFixture]\r
        public class DnsTest\r
        {\r
-               private String site1Name = "go-mono.com",\r
-                       site1Dot = "74.208.222.19",\r
+               private String site1Name = "mono-project.com",\r
+                       site1Dot = "96.126.105.110",\r
                        site2Name = "info.diku.dk",\r
                        site2Dot = "130.225.96.4",\r
-                       noneExistingSite = "www.unlikely.novell.com";\r
-               private uint site1IP = 1255202323, site2IP = 2195808260; // Big-Endian\r
+                       noneExistingSite = "unlikely.xamarin.com";\r
+               private uint site1IP = 1852407392, site2IP = 2195808260; // Big-Endian\r
 \r
                [Test]\r
                public void AsyncGetHostByName ()\r
@@ -44,7 +44,7 @@ namespace MonoTests.System.Net
                        IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);\r
                        IPHostEntry entry = Dns.EndGetHostByName (async);\r
                        SubTestValidIPHostEntry (entry);\r
-                       Assert.AreEqual ("go-mono.com", entry.HostName);\r
+                       Assert.IsTrue (entry.HostName == "www.mono-project.com" || entry.HostName == "mono-project.com");\r
                }\r
 \r
                void GetHostByNameCallback (IAsyncResult ar)\r
@@ -191,10 +191,24 @@ namespace MonoTests.System.Net
                [Test]\r
                public void GetHostByName ()\r
                {\r
-                       SubTestGetHostByName (site1Name, site1Dot);\r
+                       SubTestGetHostByName ("www.mono-project.com", site1Dot);\r
                        SubTestGetHostByName (site2Name, site2Dot);\r
                        try {\r
-                               Dns.GetHostByName (noneExistingSite);\r
+                               var entry = Dns.GetHostByName (noneExistingSite);\r
+                               /*\r
+                                * Work around broken t-online.de DNS Server.\r
+                                * \r
+                                * T-Online's DNS Server for DSL Customers resolves\r
+                                * non-exisitng domain names to\r
+                                * http://navigationshilfe1.t-online.de/dnserror?url=....\r
+                                * instead of reporting an error.\r
+                                */\r
+                               var navigationshilfe1 = IPAddress.Parse ("80.156.86.78");\r
+                               var navigationshilfe2 = IPAddress.Parse ("62.157.140.133");\r
+                               foreach (var addr in entry.AddressList) {\r
+                                       if (addr.Equals (navigationshilfe1) || addr.Equals (navigationshilfe2))\r
+                                               return;\r
+                               }\r
                                Assert.Fail ("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");\r
                        } catch (SocketException) {\r
                        }\r
@@ -260,11 +274,6 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test]\r
-/*** Current go-mono.com IP works fine here***\r
-#if ONLY_1_1\r
-               [ExpectedException (typeof (SocketException))]\r
-#endif\r
-********/\r
                public void GetHostByAddressString5 ()\r
                {\r
                        Dns.GetHostByAddress (site1Dot);\r
@@ -347,7 +356,6 @@ namespace MonoTests.System.Net
                        }\r
                }\r
 \r
-#if NET_2_0\r
                [Test] // BeginGetHostEntry (IPAddress, AsyncCallback, Object)\r
                public void BeginGetHostEntry1_Address_Null ()\r
                {\r
@@ -492,7 +500,6 @@ namespace MonoTests.System.Net
                                Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#B5");\r
                        }\r
                }\r
-#endif\r
 \r
                void SubTestValidIPHostEntry (IPHostEntry h)\r
                {\r