public void is_ip_lockedTest_users_should_not_lock_out_an_unknown_ip() { Service_Manager_Accessor target = new Service_Manager_Accessor(); string ip = "some address"; bool expected = false; // account should not be locked bool actual; actual = target.is_ip_locked(ip); Assert.AreEqual(expected, actual); }
public void is_ip_lockedTest_users_should_not_lock_out_after_three_attempts_when_time_between_attempts_is_greater_then_needed() { Service_Manager_Accessor target = new Service_Manager_Accessor(); string ip = "some address"; log_ip_fail ip_attempt = new log_ip_fail(ip); ip_attempt.Record_Failed_Attempt(); ip_attempt.Last_Attempt = new DateTime(1990, 3, 3); target._attempts.Add(ip_attempt); bool expected = false; // account should not be locked bool actual; actual = target.is_ip_locked(ip); Assert.AreEqual(expected, actual); }
public void record_failed_attemptTest_should_update_ip_record_when_ip_is_found() { Service_Manager_Accessor target = new Service_Manager_Accessor(); string ip = "make belive IP"; target.record_failed_attempt(ip); target.record_failed_attempt(ip); Assert.AreEqual(1, target._attempts.Count); Assert.AreEqual(2, target.find_attempt_by_ip(ip).Fail_Count); }
public void record_failed_attemptTest_should_create_a_new_ip_record_when_none_is_found() { Service_Manager_Accessor target = new Service_Manager_Accessor(); string ip = "make belive IP"; target.record_failed_attempt(ip); Assert.IsNotNull(target.find_attempt_by_ip(ip)); }