public void LoginModule_CreateUser_AllInputOk_Void() { LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username1", "password", "password"); Assert.IsTrue(true); }
public void LoginModule_UpdateUser_ChangePassword_Bool() { LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username11", "password", "password"); bool b = l.UpdateUser("username11", "password", "123456", "123456"); Assert.IsTrue(b); }
public void LoginModule_CreateUser_UsernameRules_int() { //bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username7", "123456", "123456"); //relger for username skal laves for test kan få error number 4 Assert.IsTrue(true); }
public void LoginModule_LoginUser_loginSucces_bool() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username8", "123456", "123456"); b = l.LoginUser("username8", "123456"); Assert.IsTrue(b); }
public void LoginModule_DeleteUser_DeleteUser_bool() { LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username10", "123456", "123456"); bool b; string hashedpassword = FakeHelper.HashPassword("123456"); b = l.DeleteUser("username10", hashedpassword); Assert.IsTrue(b); }
public void LoginModule_CreateUser_PasswordNotMatch_int() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); if (l.CreateUser("username3", "123456", "654321") == 2) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_UsernameAvailable_int() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username5", "123456", "123456"); if (l.CreateUser("username5", "123456", "123456") == 1) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_Shortpassword_int() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); if (l.CreateUser("username2", "1234", "1234") == 3) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_PasswordNotHashed_bool() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username4", "123456", "123456"); //test if password has been hashed. change b to true if (!FakeDatabase.GetHashedPassword("username4").Equals("123456")) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_PasswordNotMatch_Void() { bool b = false; try { LoginComponent.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Login l = new LoginComponent.Login(fdm); l.CreateUser("username3", "123456", "654321"); } catch (Exception) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_Shortpassword_Exception() { bool b = false; try { LoginComponent.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Login l = new LoginComponent.Login(fdm); l.CreateUser("username2", "1234", "1234"); } catch (Exception) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_UsernameAvailable_Exception() { bool b = false; LoginComponent.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Login l = new LoginComponent.Login(fdm); l.CreateUser("username5", "123456", "123456"); try { l.CreateUser("username5", "123456", "123456"); } catch (Exception) { b = true; } Assert.IsTrue(b); }
public void LoginModule_CreateUser_UserStorged_Void() { bool b = false; LoginComponent.TechnicalService.ILoginDataMapper fdm = new FakeILoginDataMapper(); LoginComponent.Controller.Login l = new LoginComponent.Controller.Login(fdm); l.CreateUser("username6", "123456", "123456"); string hashedpassword = FakeHelper.HashPassword("123456"); foreach (var x in FakeDatabase.user_table) { if (x.username.Equals("username6") && x.hashedPassword.Equals(hashedpassword)) { b = true; } } Assert.IsTrue(b); }