public void TestSuccessfulCase() { string password1Hashed = PasswordHasher.GetHash(password1); string password2Hashed = PasswordHasher.GetHash(password2); string password3Hashed = PasswordHasher.GetHash(password3); bool status; // 1. Check if password hashes the same way Assert.Equal(password1Hashed, PasswordHasher.GetHash(password1)); AuthDatabaseUtils connection = new AuthDatabaseUtils(server, database, isTrusted, login1, password1, connectionTimeOut); status = connection.AddCredentials(login2, password2Hashed); // 2. Check status of adding credentials Assert.True(status); status = connection.CheckCredentials(login2, password2Hashed); // 3. Check if credentials were saved Assert.True(status); status = connection.UpdateCredentials(login2, password2Hashed, login3, password3Hashed); // 4. Check status Assert.True(status); status = connection.CheckCredentials(login3, password3Hashed); // 5. Check if credentials were updated Assert.True(status); status = connection.DeleteCredentials(login3, password3Hashed); // 6. Check status Assert.True(status); status = connection.CheckCredentials(login3, password3Hashed); // 7. Check if credentials were deleted Assert.False(status); }
public void TestCheckCredentials() { string login = "******"; string password = "******"; Assert.IsTrue(authDatabaseUtils.AddCredentials(login, PasswordHasher.GetHash(password))); Assert.IsTrue(authDatabaseUtils.CheckCredentials(login, PasswordHasher.GetHash(password))); }
public void CheckValidCredentialsReturnsTrue() { string login = "******"; string password = "******"; Assert.IsTrue(authDatabaseUtils.AddCredentials(login, PasswordHasher.GetHash(password))); Assert.IsTrue(authDatabaseUtils.CheckCredentials(login, PasswordHasher.GetHash(password))); }
public void CheckCredsTest() { string login = "******"; string password = PasswordHasher.GetHash("checkpswd"); authDatabaseUtils.AddCredentials(login, password); Assert.True(authDatabaseUtils.CheckCredentials(login, password)); }
public void PositiveCheckCredentials() { string oldLogin = "******"; string oldPass = PasswordHasher.GetHash("test"); bool result = storageDatкabaseUtils.CheckCredentials(oldLogin, oldPass); Assert.IsTrue(result); }
public void Database_CheckFew() { /*bool res; * bool res2 = authDatabaseUtils.CheckCredentials(dLogin, dPassword); * bool res1 = authDatabaseUtils.CheckCredentials(newdLogin, newdPassword); * * if (res1 == true && res2 == true) * res = true; * else * res = false;*/ Assert.IsTrue(authDatabaseUtils.CheckCredentials(dLogin, dPassword) && authDatabaseUtils.CheckCredentials(newdLogin, newdPassword)); }
public void TestGetHash_Push_to_DB_ValidFields(string login, string password, string salt = null, uint?adlerMod = null) { try { string hash = PasswordHasher.GetHash(password, salt, adlerMod); Assert.IsTrue(authDatabase.AddCredentials(login, hash), "The system does not add a non-existent user with next input data " + $"login: {login}, password: ${password}, salt: {salt}, adlerMod: ${adlerMod}"); Assert.IsTrue(authDatabase.CheckCredentials(login, hash), "There must be a user on the system with " + $"login: {login}, password: ${password}"); } catch (Exception err) { Assert.Fail(err.Message); } }
public void AuthDbCheckTrue(string pass, string login) { string hashed = PasswordHasher.GetHash(pass, login); adu.AddCredentials(login, hashed); Assert.True(adu.CheckCredentials(login, hashed)); }
public void CheckCreadentialsTest() { Assert.IsTrue(authDatabaseUtils.CheckCredentials("login", PasswordHasher.GetHash("password"))); Assert.IsTrue(authDatabaseUtils.CheckCredentials("another login 1", PasswordHasher.GetHash("password"))); Assert.IsTrue(authDatabaseUtils.CheckCredentials("another login 2", PasswordHasher.GetHash("pass"))); Assert.IsTrue(authDatabaseUtils.CheckCredentials("another login 3", PasswordHasher.GetHash(""))); Assert.IsFalse(authDatabaseUtils.CheckCredentials("another login 1", PasswordHasher.GetHash("password password"))); Assert.IsFalse(authDatabaseUtils.CheckCredentials("another login 5", PasswordHasher.GetHash("pass"))); }
public void CheckCredentials_WithRightCredentials() { Assert.IsTrue(connection.CheckCredentials("Mariia", PasswordHasher.GetHash("MASHA", "salt", 2))); }
public void CheckRightCredentialsTest() { Assert.IsTrue(connectionWithDB.CheckCredentials(userName1, PasswordHasher.GetHash(password1, salt1))); Assert.IsTrue(connectionWithDB.CheckCredentials(userName4, PasswordHasher.GetHash(password4, salt4))); }
public void CheckCredentialsTestNull() { auth.AddCredentials("12 test login", PasswordHasher.GetHash("12 test password")); Assert.Throws <ArgumentNullException>(() => auth.DeleteCredentials(null, PasswordHasher.GetHash(null))); Assert.Throws <ArgumentNullException>(() => auth.DeleteCredentials("12 test login", PasswordHasher.GetHash(null))); Assert.False(auth.CheckCredentials(null, PasswordHasher.GetHash("12 test password"))); }
public void Test_TypicalData() { string login = "******"; string password = PasswordHasher.GetHash("usualPassword"); Assert.True(db.AddCredentials(login, password)); Assert.True(db.CheckCredentials(login, password)); Assert.True(db.DeleteCredentials(login, password)); }
public void CheckNonExistingCredentials() { Assert.False(authDatabaseUtils.CheckCredentials("test", PasswordHasher.GetHash("p"))); }
public void Database_Check() { Assert.IsTrue(authDatabaseUtils.CheckCredentials(dLogin, dPassword)); }