public void AuthenticateUserTestCase3() { UserManagement um = new UserManagement(); var isAuthenticated_1 = um.Authenticate("ssimmons0", generateString(6)); var isAuthenticated_2 = um.Authenticate("ssimmons0", generateString(100)); var isAuthenticated_3 = um.Authenticate("ssimmons0", generateString(255)); Assert.IsFalse(isAuthenticated_1); Assert.IsFalse(isAuthenticated_2); Assert.IsFalse(isAuthenticated_3); }
public void AuthenticateUserInCorrectCredentials() { UserManagement um = new UserManagement(); var isAuthenticated = um.Authenticate("ssimmons", "MtqO"); Assert.IsFalse(isAuthenticated); }
public void AuthenticateUserCorrectCredentials() { UserManagement um = new UserManagement(); var isAuthenticated = um.Authenticate("ssimmons0", "MtqOJc"); Assert.IsTrue(isAuthenticated); }
public void AuthenticateUserTestCase4() { var isAuthenticated = false; UserManagement um = new UserManagement(); isAuthenticated = um.Authenticate(string.Empty, string.Empty); Assert.IsFalse(isAuthenticated); }
public void AuthenticateUserTestCase2() { var isAuthenticated = false; UserManagement um = new UserManagement(); isAuthenticated = um.Authenticate(generateString(201), generateString(256)); Assert.IsFalse(isAuthenticated); }
public void AuthenticateUserTestCase1() { var isAuthenticated = false; try { UserManagement um = new UserManagement(); isAuthenticated = um.Authenticate(null, null); } finally { Assert.IsFalse(isAuthenticated); } }
public override void Run() { Console.Clear(); Console.WriteLine(MenuSystem.Path); if (UserManagement.CurrentUser == null) { Console.Write("Enter User ID: "); string userId = Console.ReadLine(); Console.Write("Enter Password: "******"Please enter valid User ID and Password"); Console.Write("ID:"); userId = Console.ReadLine(); Console.Write("Enter Password: "******"You are already logged in"); Console.WriteLine("\n1. Log-out\n2. Want to Continue"); Int32.TryParse("" + Console.ReadKey(true).KeyChar, out choice); switch (choice) { case 1: UserManagement.CurrentUser = null; return; case 2: //menuSystem.AddScreen(new SignUpMain()); break; default: break; } Console.WriteLine(); } if (UserManagement.ProfileType() == ProfileType.Manager) { menuSystem.AddScreen(new ManagerMain()); } else { menuSystem.AddScreen(new CustomerScreen()); } }
/// <summary> /// AttemptToLogUserIn method /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <returns></returns> public LoginModel AttemptToLogUserIn(string userName, string password) { LoginModel myLoginModel = new LoginModel(); var myUserManagement = new UserManagement(); var authenticationResult = myUserManagement.Authenticate(userName, password); if ((authenticationResult == UserManagement.AuthenticationResults.InvalidPassword) || (authenticationResult == UserManagement.AuthenticationResults.NoMatchingUser)) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.BadOrIncorrectUsernameOrPassword; myLoginModel.Errors = true; return myLoginModel; } if (authenticationResult == UserManagement.AuthenticationResults.ChangePassword) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.ChangePassword; myLoginModel.Errors = true; return myLoginModel; } if (authenticationResult != UserManagement.AuthenticationResults.Success) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.UnknownResult; myLoginModel.Errors = true; return myLoginModel; } myLoginModel.User = myUserManagement.GetUserDetails(userName); myLoginModel.Groups = myUserManagement.GetUserGroups(userName); if(myLoginModel.User == null || myLoginModel.Groups.Count == 0) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.NoUserRoles; myLoginModel.Errors = true; return myLoginModel; } return myLoginModel; }