[System*] Throw a PlatformNotSupported exception when using the networking stack...
[mono.git] / mcs / class / System / Test / System.Net.Sockets / TcpListenerTest.cs
index 1e211cf524920b999f0f090353814030a6dff829..25e8854ed6a87635c18cdec0a9f8778959ad2327 100644 (file)
@@ -20,10 +20,12 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class TcpListenerTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TcpListener ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -75,6 +77,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CtorInt1 ()
                {
                        int nex = 0;
@@ -87,21 +92,33 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentNullException))]
+#endif
                public void CtorIPEndPoint ()
                {
                        new TcpListener (null);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentNullException))]
+#endif
                public void CtorIPAddressInt1 ()
                {
                        new TcpListener (null, 100000);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#endif
                public void CtorIPAddressInt2 ()
                {
                        new TcpListener (IPAddress.Any, 100000);
@@ -125,6 +142,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PreStartStatus ()
                {
                        MyListener listener = new MyListener ();
@@ -152,6 +172,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PostStartStatus ()
                {
                        MyListener listener = new MyListener ();
@@ -173,6 +196,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StartListenMoreThan5 ()
                {
                        var port = NetworkHelpers.FindFreePort ();