public void TestUserToString() { User user1 = new User(); user1.Email = "*****@*****.**"; user1.Fullname = "Stefano"; user1.IsAdmin = false; user1.Nickname = "Stefan"; user1.UserID = 1; user1.Username = "******"; Assert.AreEqual("Username: stefanverhoeve, Email: [email protected], Fullname: Stefano", user1.ToString(), "The ToString methods of the actual object doesnt match the expected string"); }
/// <summary> /// Login methode, zoekt een gebruiker die overeenkomt met ingevulde gegevens (mits deze bestaat) en logt deze in /// zet de static property "LoggedinUser" /// </summary> /// <param name="username">gebruikersnaam van de gebruiker</param> /// <param name="password">wachtwoord van de gebruiker</param> /// <returns>bool succes of niet</returns> public bool Login(string username, string password) { foreach (Dictionary<string, object> D in database.getQuery(connection.GetUserPassword(username))) { if((string)D["password"] == password) { LoggedInUser = new User(Convert.ToInt32(D["userid"]), (string)D["username"], (string)D["email"], (string)D["fullname"], (string)D["nickname"], (string)D["isadmin"]); return true; } } return false; }