Пример #1
0
        public void RegisterUserTest()
        {
            IUserDAO userDao = new IUserDAOImpl();
            bool     result  = userDao.Register(new Users("falcon", MD5Util.GetMD5("123456")));

            Assert.AreEqual(true, result);
        }
Пример #2
0
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters,
                                                ClientPeer clientPeer)
        {
            Dictionary <byte, object> data = operationRequest.Parameters;
            string            username     = DictUtil.GetValue(data, (byte)ParameterCode.Username) as string;
            string            password     = DictUtil.GetValue(data, (byte)ParameterCode.Password) as string;
            IUserDAO          dao          = new IUserDAOImpl();
            Users             u            = new Users(username, password);
            OperationResponse resp         = new OperationResponse(operationRequest.OperationCode);

            resp.ReturnCode = (short)(dao.Register(u) ? ReturnCode.RegisterSuccess : ReturnCode.RegisterFailed);
            clientPeer.SendOperationResponse(resp, sendParameters);
        }