public void TestClientConnectionLoginSuccess()
        {
            using (mocks.Record())
            {
                mockSocket.connect(iSocket.constants.host, iSocket.constants.defaultPort);
                LastCall.On(mockSocket).Repeat.Once();
                // Caesura
                mockSocket.send(iSocket.aSocket.stringToBytes("Caesura" + "\0", iSocket.constants.MAXPACKETSIZE));
                LastCall.On(mockSocket).Repeat.Once();
                // Major
                mockSocket.send(iSocket.aSocket.stringToBytes(iSocket.constants.MajorNumber, iSocket.constants.MAXPACKETSIZE));
                LastCall.On(mockSocket).Repeat.Once();
                // Minor
                mockSocket.send(iSocket.aSocket.stringToBytes(iSocket.constants.MinorNumber, iSocket.constants.MAXPACKETSIZE));
                LastCall.On(mockSocket).Repeat.Once();
                // Username
                mockSocket.send(iSocket.aSocket.stringToBytes("TestUser" + "\0", iSocket.constants.MAXPACKETSIZE));
                LastCall.On(mockSocket).Repeat.Once();
                // Password
                mockSocket.send(iSocket.aSocket.stringToBytes("TestPass" + "\0", iSocket.constants.MAXPACKETSIZE));
                LastCall.On(mockSocket).Repeat.Once();

                mockSocket.receive(iSocket.constants.MAXPACKETSIZE);
                LastCall.Return(iSocket.aSocket.stringToBytes("True", iSocket.constants.MAXPACKETSIZE));
            }

            Assert.True(connection.login("TestUser", "TestPass"));
            mocks.VerifyAll();
        }
Exemple #2
0
 public void connect()
 {
     sock.connect(iSocket.constants.serverip, iSocket.constants.defaultPort);
 }