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); }
public void TerminateConnection() { try { StateController controller = new StateController(); Int32 handle = controller.CreateConnection("localhost", 6667); Assert.AreEqual(1, handle); controller.TerminateConnection(handle); } catch(Exception exception) { Assert.Fail(exception.Message); } }
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(); } }