ForumClientCore.ClientController.Register C# (CSharp) Method

Register() public method

public Register ( string userName, string password ) : System.Result
userName string
password string
return System.Result
        public Result Register(string userName, string password)
        {
            return netAdaptor.Register(userName, password);
        }

Usage Example

Example #1
0
        public void LoginRegisterTests()
        {
            ClientController cc = new ClientController();

            Assert.IsFalse(cc.Login("user1", "123456"));//login before register

            if(cc.Register("alice", "123456") == Result.SECURITY_ERROR)
                Assert.AreEqual(Result.SECURITY_ERROR, cc.Register("alice", "123456"));
            else
                Assert.AreEqual(Result.OK, cc.Register("alice", "123456"));

            //login tests - torture test
            for (int i = 0; i < 100; i++)
            {
                // try to register twice with same userName
                if (cc.Register("alice" + i, "123456") == Result.OK)
                    Assert.AreEqual(Result.SECURITY_ERROR, cc.Register("alice" + i, "123456"));
                else
                    Assert.AreEqual(Result.SECURITY_ERROR, cc.Register("alice" + i, "123456"));

                //failed: try to login twice with same userName return true , should return false.
               // Assert.IsTrue(cc.Login("alice" + i, "123456"));
               // Assert.IsFalse(cc.Login("alice" + i, "123456"));

                Assert.IsFalse(cc.Login("bob" + i, "123456"));//try to login with bad unknown user
                Assert.IsFalse(cc.Login("alice" + i, "123456" + i));//try to login with bad password
            }
        }
All Usage Examples Of ForumClientCore.ClientController::Register