mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 12:31:30 -10:00
* SocketTest.cs: added test for Select with empty lists. Changed the 'bogus' address of EndConnect test. svn path=/trunk/mcs/; revision=28875
50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
// System.Net.Sockets.TcpClientTest.cs
|
|
//
|
|
// Authors:
|
|
// Brad Fitzpatrick ([email protected])
|
|
//
|
|
// (C) Copyright 2003 Brad Fitzpatrick
|
|
//
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.System.Net.Sockets
|
|
{
|
|
[TestFixture]
|
|
public class SocketTest
|
|
{
|
|
[Test]
|
|
public void EndConnect ()
|
|
{
|
|
IPAddress ipOne = IPAddress.Parse ("192.168.244.244"); // something bogus
|
|
IPEndPoint ipEP = new IPEndPoint (ipOne, 23483); // something bogus
|
|
Socket sock = new Socket (ipEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
|
IAsyncResult ar = sock.BeginConnect (ipEP, null, null);
|
|
bool gotException = false;
|
|
|
|
try {
|
|
sock.EndConnect (ar); // should raise an exception because connect was bogus
|
|
} catch {
|
|
gotException = true;
|
|
}
|
|
|
|
Assertion.AssertEquals ("A01", gotException, true);
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (ArgumentNullException))]
|
|
public void SelectEmpty ()
|
|
{
|
|
ArrayList list = new ArrayList ();
|
|
Socket.Select (list, list, list, 1000);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|