Exemple #1
0
        public ActionResult Register(string naam, string pass)
        {
            RPGRepository rpgrepo = new RPGRepository(rpgsql);

            rpgrepo.AddUserToDB(naam, pass);

            return(RedirectToAction("Login"));
        }
        public void Account_Add()
        {
            RPGSQLContext context      = new RPGSQLContext();
            RPGRepository repo         = new RPGRepository(context);
            string        testlogin    = "******";
            string        testPassword = "******";

            //Add user with a test login/password
            repo.AddUserToDB(testlogin, testPassword);

            //Create a user with the created account
            User loggedUser = new User();

            loggedUser.Username = testlogin;
            loggedUser.Password = testPassword;

            //Test correct password entry with the newly created account
            Assert.AreEqual(true, repo.TryLogin(loggedUser.Username, loggedUser.Password));

            //Test incorrect password entry
            Assert.AreEqual(false, repo.TryLogin(loggedUser.Username, "Randompass"));
        }