示例#1
0
        public void CreateUser_ExistingUser_ThrowsExistingUserException()
        {
            var randomUsername = TestData.CreateRandomString();
            var randomPassword = TestData.CreateRandomString();
            var existingUser   = new User();

            var getUserData = new Mock <IGetUserAuth>();

            getUserData.Setup(x => x.Get(randomUsername)).Returns(existingUser);
            var sut = new AddUser(getUserData.Object, _sqlQuery.Object);

            Assert.That(() => sut.CreateUser(randomUsername, randomPassword),
                        Throws.Exception.TypeOf <ExistingUserException>());
        }
示例#2
0
    public void RegisterButton()
    {
        string user  = regUsername.text;
        string pass  = regPassword.text;
        string rpass = regRepeatPassword.text;

        if (!user.Equals("") && !pass.Equals("") && !rpass.Equals(""))
        {
            if (pass.Length > 4)
            {
                if (!ld.userExists(user))
                {
                    if (pass.Equals(rpass))
                    {
                        au.CreateUser(user, pass);
                        //StartCoroutine (ld.Start ());
                    }
                    else
                    {
                        errorTxt.text = "Passwords must match!";
                        Fade();
                    }
                }
                else
                {
                    errorTxt.text = "Username already exists!";
                    Fade();
                }
            }
            else
            {
                errorTxt.text = "Password must be longer than 5 characters!";
                Fade();
            }
        }
        else
        {
            errorTxt.text = "Please enter a valid Username and password!";
            Fade();
        }
    }