Esempio n. 1
0
 public void InitializeConnection()
 {
     StateController controller = new StateController();
     controller.CreateConnection("localhost", 6667);
     controller.InitializeConnection(1, "xpto", "d1", "d2", "d3", "d4");
     Assert.AreEqual("NICK xpto", ((ServerConnectionHandler) server.Clients[0]).GetMessage());
     Assert.AreEqual("USER d1 d2 d3 :d4", ((ServerConnectionHandler) server.Clients[0]).GetMessage());
     controller.TerminateConnection(1);
 }
Esempio n. 2
0
 public void CreateConnection()
 {
     try
     {
         StateController controller = new StateController();
         Int32 handle = controller.CreateConnection("localhost", 6667);
         Assert.AreEqual(1, handle);
     }
     catch(Exception exception)
     {
         Assert.Fail(exception.Message);
     }
 }
Esempio n. 3
0
        public void TerminateInvalidHandle()
        {
            try
            {
                StateController controller = new StateController();
                controller.TerminateConnection(-1);
                Assert.Fail();
            }
            catch(IndexOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }

            try
            {
                StateController controller = new StateController();
                controller.CreateConnection("localhost", 6667);
                controller.TerminateConnection(2);
                Assert.Fail();
            }
            catch(IndexOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }