public void Create_User_Success() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); Assert.AreEqual(1, UserDB.listOfUsers.Count); }
public bool Register(string user, string password) { if (user == string.Empty || password == string.Empty) { return(false); } if (!userDB.UserExist(user)) { return(userDB.AddNewUser(user, password)); } throw new CustomException("User has already registered!!"); }
public void Search_User_By_Name_Fail() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); Assert.AreEqual(null, UserDB.GetUserByName("Sinisa")); }
public void Search_User_By_Name_Success() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); Assert.AreEqual(testUser, UserDB.GetUserByName("Marko")); }
public void Get_All_Users_Success() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); Assert.AreEqual(1, UserDB.GetAllUsers().Count); }
public void Delete_User_Fail() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); UserDB.DeleteUser(2); Assert.AreEqual(1, UserDB.listOfUsers.Count); }
public ActionResult RegistrationForm(string userName, string pass, string email) { UserModel newUser = new UserModel(userName, pass, email); bool isAdded = user.AddNewUser(newUser); if (isAdded == true) { int id = user.getUserId(userName, pass); game.CreateRankingForUser(id); return(RedirectToAction("LogIn")); } else { Session["error"] = "Vartotojas tokiu vardu jau yra"; return(RedirectToAction("Register")); } }
public void Create_User_Fail() { ClearUsers(); User testUser1 = new User { Id = 1, Name = "Marko" }; User testUser2 = new User { Id = 1, Name = "Sinisa" }; UserDB.AddNewUser(testUser1); UserDB.AddNewUser(testUser2); Assert.AreEqual(1, UserDB.listOfUsers.Count); }
public void Modify_User_Fail() { ClearUsers(); User testUser = new User { Id = 1, Name = "Marko" }; UserDB.AddNewUser(testUser); User testUser1 = new User { Id = 1, Name = "Sinisa" }; UserDB.ModifyUser(testUser1); Assert.AreEqual(null, UserDB.GetUserByName("Marko")); }