Ejemplo n.º 1
0
 public void TerminateConnection()
 {
     IRCConnection connection = new IRCConnection("localhost", 6667);
     TcpClient client = listener.AcceptTcpClient();
     connection.Close();
     client.Close();
     Assert.IsFalse(listener.Pending());
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 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();
     }
 }
Ejemplo n.º 5
0
 public void CreateConnection()
 {
     IRCConnection connection = new IRCConnection("localhost", 6667);
     Assert.IsTrue(listener.Pending());
 }
Ejemplo n.º 6
0
 public Connection CreateConnection(String servername, Int32 port, MessageForm outputWindow)
 {
     IRCConnection connection = new IRCConnection(servername, port);
     windows.Add(connection, outputWindow);
     return connection;
 }
Ejemplo n.º 7
0
 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));
     }
 }