public void TerminateConnection() { IRCConnection connection = new IRCConnection("localhost", 6667); TcpClient client = listener.AcceptTcpClient(); connection.Close(); client.Close(); Assert.IsFalse(listener.Pending()); }
public void CreateClientNICKCommand() { IRCConnection connection = new IRCConnection("localhost", 6667); TcpClient client = listener.AcceptTcpClient(); StreamReader reader = new StreamReader(client.GetStream(), Encoding.ASCII); connection.SendNickCommand("xpto"); Assert.AreEqual("NICK xpto", reader.ReadLine()); connection.Close(); }
public void CreateRegistrationCommand() { IRCConnection connection = new IRCConnection("localhost", 6667); TcpClient client = listener.AcceptTcpClient(); StreamReader reader = new StreamReader(client.GetStream(), Encoding.ASCII); connection.RegisterUser("HelloWorld", "p1", "p2", "p3", "p4"); Assert.AreEqual("NICK HelloWorld", reader.ReadLine()); Assert.AreEqual("USER p1 p2 p3 :p4", reader.ReadLine()); connection.Close(); }
public void CreateServerNICKCommand() { IRCConnection connection = new IRCConnection("localhost", 6667); connection.CommandArrived += new Connection.CommandArrivedDelegate(CreateNICKCommand_CommandArrived); TcpClient client = listener.AcceptTcpClient(); StreamWriter writer = new StreamWriter(client.GetStream(), Encoding.ASCII); try { writer.NewLine = "\r\n"; writer.WriteLine(":xpto NICK xpto2"); writer.Flush(); lock(this) { Assert.IsTrue(Monitor.Wait(this), "Event wasn't called."); } } finally { writer.Close(); client.Close(); connection.Close(); } }
public void CreateConnection() { IRCConnection connection = new IRCConnection("localhost", 6667); Assert.IsTrue(listener.Pending()); }
public Connection CreateConnection(String servername, Int32 port, MessageForm outputWindow) { IRCConnection connection = new IRCConnection(servername, port); windows.Add(connection, outputWindow); return connection; }
public void CreateServerPingCommand() { IRCConnection connection = new IRCConnection("localhost", 6667); connection.CommandArrived += new BlackCubeSolutions.Talk.Connection.CommandArrivedDelegate(CreateServerPingCommand_CommandArrived); TcpClient client = listener.AcceptTcpClient(); StreamWriter writer = new StreamWriter(client.GetStream(), Encoding.ASCII); writer.NewLine = "\r\n"; writer.AutoFlush = true; writer.WriteLine("PING :ABC1234"); lock(this) { Assert.IsTrue(Monitor.Wait(this)); } }