/// <summary> /// Login progressed, so update the text displayed. /// </summary> /// <param name="CurrentProcess">What stage of the login progress are we in?</param> public void UpdateStatus(LoginProcess CurrentProcess) { m_LblCurrentStatus.Caption = m_CSTCurrentStatus[(int)CurrentProcess]; switch (CurrentProcess) { case LoginProcess.Authorizing: m_ProgressInPercentage = 0; break; case LoginProcess.Attempting: m_ProgressInPercentage = 25; break; case LoginProcess.Initial: m_ProgressInPercentage = 50; break; case LoginProcess.Loading: m_ProgressInPercentage = 75; break; case LoginProcess.DoneLoading: m_ProgressInPercentage = 100; break; } }
public void ReturnUserObject_when_usercredentials_are_valid() { string username = "******"; string password = "******"; UserDataObject userobject = new UserDataObject { Id = 1, FirstName = "firstname", LastName = "lastname", EncryptedPassword = IGenProtector.Encrypt(password), IsActive = true, IsAccountActivated = true }; var userDataMock = new Mock <IUserData>(); userDataMock.Setup(x => x.Get(username)).Returns(userobject); IUserForgotPassword userForgotPassword = Mock.Of <IUserForgotPassword>(); ILoginProcess loginProcess = new LoginProcess(userDataMock.Object, userForgotPassword); UserDataObject result = loginProcess.Authenticate(username, password); Assert.AreEqual(userobject.Id, result.Id); Assert.AreEqual(userobject.FirstName, result.FirstName); Assert.AreEqual(userobject.LastName, result.LastName); }
/// <summary> /// Updates this LoginProgressDialog with the status of /// the current login process being performed. /// </summary> /// <param name="CurrentProcess">The current status.</param> public void UpdateStatus(LoginProcess CurrentProcess) { m_StatusBar.UpdateStatus(CurrentProcess); switch (CurrentProcess) { case LoginProcess.Unavailable: m_ErrorMsgBox.Message = m_CSTCurrentStatus[36 /*(int)LoginProcess.Unavailable*/]; m_ErrorMsgBox.Show(); break; case LoginProcess.Authorizing: m_ProgressBar.SetProgressInPercentage(0); break; case LoginProcess.Attempting: m_ProgressBar.SetProgressInPercentage(25); break; case LoginProcess.Initial: m_ProgressBar.SetProgressInPercentage(50); break; case LoginProcess.Loading: m_ProgressBar.SetProgressInPercentage(75); break; case LoginProcess.DoneLoading: m_ProgressBar.SetProgressInPercentage(100); break; } }
public void ThrowUsernameAndPasswordRequiredException_when_username_or_password_is_empty() { IUserData userDataMock = Mock.Of <IUserData>(); IUserForgotPassword userForgotPassword = Mock.Of <IUserForgotPassword>(); ILoginProcess loginProcess = new LoginProcess(userDataMock, userForgotPassword); loginProcess.Authenticate(string.Empty, string.Empty); }
internal SharedAuthSecretImpl(string busId, LoginProcess attempt, byte[] secret, core.v2_0.services.access_control.LoginProcess legacyAttempt) { BusId = busId; Attempt = attempt; LegacyAttempt = legacyAttempt; Secret = secret; Legacy = attempt == null; _context = (OpenBusContextImpl)ORBInitializer.Context; }
[InlineData("C", "twobigavalue", false)] //password too big public void ValidateUserInput_stringsShouldVerify(string username, string password, bool expected) { //Arrange LoginProcess loginProcess = new LoginProcess(); //Act bool actual = loginProcess.ValidateLoginData(username, password); //assert Assert.Equal(expected, actual); }
public void ValidateUserInput_StringsShouldVerify(string username, string password, bool expected) { // Arrange -- the values and set up for test LoginProcess loginProcess = new LoginProcess(); // Act -- action performed in the test bool actual = loginProcess.ValidateUserInput(username, password); // Assert -- what we expect & what output is Assert.Equal(expected, actual); }
public void UserIsLocked() { const string connectionString = "./users.xml"; const int passwordExpiryDays = 90; const int accountLockoutThreshold = 9; const int lockoutDurationMinutes = 10; var userCommandRepository = new XmlUserAccountCommandRepository(connectionString); var userQueryRepository = new XmlUserAccountQueryRepository(connectionString); var retVal = new LoginProcess(userCommandRepository, userQueryRepository, passwordExpiryDays, accountLockoutThreshold, lockoutDurationMinutes) .Login("shibu_locked", "password"); Assert.IsNotNullOrEmpty(retVal, "User is Expected to be Locked, but is not locked"); }
public void UserIsAuthenticated() { const string connectionString = "./users.xml"; const int passwordExpiryDays = 90; const int accountLockoutThreshold = 9; const int lockoutDurationMinutes = 10; var userCommandRepository = new XmlUserAccountCommandRepository(connectionString); var userQueryRepository = new XmlUserAccountQueryRepository(connectionString); var retVal = new LoginProcess(userCommandRepository, userQueryRepository, passwordExpiryDays, accountLockoutThreshold, lockoutDurationMinutes) .Login("shibu", "password"); Assert.IsEmpty(retVal, "User Authentication Expected to Pass, but Failed"); }
public void ThrowInvalidCredentialsException_when_username_or_password_is_incorrect() { UserDataObject userobject = null; string username = "******"; string password = "******"; var userDataMock = new Mock <IUserData>(); userDataMock.Setup(x => x.Get(username)).Returns(userobject); IUserForgotPassword userForgotPassword = Mock.Of <IUserForgotPassword>(); ILoginProcess loginProcess = new LoginProcess(userDataMock.Object, userForgotPassword); loginProcess.Authenticate(username, password); }
void Awake() { Inst = this; AT = PlayerPrefs.GetString("AT", ""); Permissions = PlayerPrefs.GetString("PER", ""); Session = PlayerPrefs.GetString("SSN", ""); PlayerPrefs.SetInt("FBL", 0); if (FB.IsInitialized) { FB.ActivateApp(); } else { FB.Init(InitCallback, OnHideUnity); } }
public void Authenticate_throws_AccountNotActivatedException_when_account_is_not_activated() { string username = "******"; string password = "******"; UserDataObject userobject = new UserDataObject { Id = 1, FirstName = "firstname", LastName = "lastname", EncryptedPassword = IGenProtector.Encrypt(password), IsActive = true, IsAccountActivated = false }; var userDataMock = new Mock <IUserData>(); userDataMock.Setup(x => x.Get(username)).Returns(userobject); IUserForgotPassword userForgotPassword = Mock.Of <IUserForgotPassword>(); ILoginProcess loginProcess = new LoginProcess(userDataMock.Object, userForgotPassword); UserDataObject result = loginProcess.Authenticate(username, password); }
public void ThrowInvalidCredentialException_when_password_is_incorrect() { string username = "******"; string password = "******"; UserDataObject userobject = new UserDataObject { Id = 1, FirstName = "firstname", LastName = "lastname", EncryptedPassword = IGenProtector.Encrypt("somepassword"), IsActive = false, IsAccountActivated = true }; var userDataMock = new Mock <IUserData>(); userDataMock.Setup(x => x.Get(username)).Returns(userobject); IUserForgotPassword userForgotPassword = Mock.Of <IUserForgotPassword>(); ILoginProcess loginProcess = new LoginProcess(userDataMock.Object, userForgotPassword); loginProcess.Authenticate(username, password); }