public void ConnectStartsConnectionAndCaches()
        {
            MockRepository mockRepository = new MockRepository();
            var socketConnection = mockRepository.DynamicMock<IHTMLConnection>();
            TelnetProtocolTranslator connectMessageHandler =
                new TelnetProtocolTranslator(socketConnection, null, null);

            socketConnection.Expect(connection => connection.StartConnect("test.com", 25));

            socketConnection.Expect(connection => connection.ServerDisconnected += connectMessageHandler.OnDisconnected);
            socketConnection.Expect(connection => connection.ConnectionSucceeded += connectMessageHandler.OnConnectSucceeded);
            socketConnection.Expect(connection => connection.ErrorOccurred += connectMessageHandler.OnErrorOccurred);

            var message = new Message();
            message.SetData("type", "connect");
            message.SetData("server", "test.com");
            message.SetData("port", 25);
            message.clientId = "abc";
            message.channel = "def";

            mockRepository.ReplayAll();
            connectMessageHandler.HandleMessage(message);
            Assert.AreEqual("abc", connectMessageHandler.ClientId);
            Assert.AreEqual("def", connectMessageHandler.Channel);
            mockRepository.VerifyAll();
        }
        public void TextTypedForwardsLine()
        {
            MockRepository mockRepository = new MockRepository();
            var socketConnection = mockRepository.DynamicMock<IHTMLConnection>();
            var connectMessageHandler = new TelnetProtocolTranslator(socketConnection, null, null);

            socketConnection.Expect(connection => connection.Send("line typed"));

            var message = new Message();
            message.SetData("type", "textEntered");
            message.SetData("text", "line typed");

            mockRepository.ReplayAll();
            connectMessageHandler.HandleMessage(message);
            mockRepository.VerifyAll();
        }