Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Henry <ludovic@xamarin.com>2017-02-16 15:18:12 +0300
committerGitHub <noreply@github.com>2017-02-16 15:18:12 +0300
commitff5956eacbdcab4262cf5f40c5afdc873ecc1ac3 (patch)
treef151cf37f9f76b1875455b1aec1df27c5e7bb84f /mcs/class/System/Test
parentfd6829c5b9f546c0c18bbfac1f5f2f7f91055550 (diff)
[socket] Add EPROTOTYPE error case (#4391)
Fixes bug https://bugzilla.xamarin.com/show_bug.cgi?id=52549
Diffstat (limited to 'mcs/class/System/Test')
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/SocketTest.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
index 7a0851912ea..bce47bcbf0d 100755
--- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
+++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
@@ -4675,6 +4675,29 @@ namespace MonoTests.System.Net.Sockets
Assert.IsTrue (mre.WaitOne (1000), "ConnectedAsync timeout");
}
+
+ [Test] // Covers https://bugzilla.xamarin.com/show_bug.cgi?id=52549
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+ public void SocketMismatchProtocol ()
+ {
+ try {
+ using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Tcp));
+ Assert.Fail ("#1");
+ } catch (SocketException e) {
+ // Only work on OSX
+ // Assert.AreEqual(SocketError.ProtocolType, e.SocketErrorCode, "#2");
+ }
+
+ try {
+ using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Udp));
+ Assert.Fail ("#3");
+ } catch (SocketException e) {
+ // Only work on OSX
+ // Assert.AreEqual(SocketError.ProtocolType, e.SocketErrorCode, "#4");
+ }
+ }
}
}