[System*] Add category for tests that use API that require BSD sockets.
[mono.git] / mcs / class / System / Test / System.Net.Sockets / UdpClientTest.cs
index 334f552b515a94da5491f6c3a74280c83a34771c..66b15308d1f84cb08efaae91d0bbe5b8e3acc62d 100644 (file)
@@ -15,6 +15,7 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Net.Sockets {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class UdpClientTest {
                [Test] // .ctor ()
                public void Constructor1 ()
@@ -1064,6 +1065,26 @@ namespace MonoTests.System.Net.Sockets {
 
                        client.Close ();
                }
+
+               [Test] // #6057
+               public void ReceiveIPv6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not enabled.");
+
+                       int PORT = 9997;
+                       using(var udpClient = new UdpClient (PORT, AddressFamily.InterNetworkV6))
+                       using(var udpClient2 = new UdpClient (PORT+1, AddressFamily.InterNetworkV6))
+                       {
+                               var dataSent = new byte [] {1,2,3};
+                               udpClient2.SendAsync (dataSent, dataSent.Length, "::1", PORT);
+
+                               IPEndPoint endPoint = new IPEndPoint (IPAddress.IPv6Any, 0);
+                               var data = udpClient.Receive (ref endPoint);
+
+                               Assert.AreEqual (dataSent.Length, data.Length);
+                       }
+               }
                
                /* No test for Ttl default as it is platform dependent */