- void GetHostByNameCallback (IAsyncResult ar)\r
- {\r
- IPHostEntry h;\r
- h = Dns.EndGetHostByName (ar);\r
- SubTestValidIPHostEntry (h);\r
+ [Test]\r
+ public void AsyncGetHostByNameCallback ()\r
+ {\r
+ var evt = new ManualResetEvent (false);\r
+ Exception ex = null;\r
+ Dns.BeginGetHostByName (site1Name, new AsyncCallback ((IAsyncResult ar) =>\r
+ {\r
+ try {\r
+ IPHostEntry h;\r
+ h = Dns.EndGetHostByName (ar);\r
+ SubTestValidIPHostEntry (h);\r
+ } catch (Exception e) {\r
+ ex = e;\r
+ } finally {\r
+ evt.Set ();\r
+ }\r
+ }), null);\r
+\r
+ Assert.IsTrue (evt.WaitOne (TimeSpan.FromSeconds (60)), "Wait");\r
+ Assert.IsNull (ex, "Exception");\r