public void UserManagementServiceUT_CheckIPLock_IpIsNotDisabledSuccess(string ipAddress) { // Act: Check that an non existent ip returns ArgumentExcpetions because ip does not exists. bool result; try { UserManagementServiceUT.CheckIfIPLocked(ipAddress); result = false; } catch { result = true; } Assert.IsTrue(result); }
public void UserManagementServiceUT_CheckIfIPLocked_IpIsDisabledSuccess(string ipAddress) { // Arrange: Insert Ip into ip table. bool lockResult = UserManagementServiceUT.CreateIP(ipAddress); Assert.IsTrue(lockResult); // Arrange: Attempt to faile to register 3 times. // IPs: Are only locked this way. for (int i = 0; i < 3; i++) { bool registerResult = UserManagementServiceUT.IncrementRegistrationFailures(ipAddress, Constants.RegistrationTriesResetTime, Constants.MaxRegistrationAttempts); Assert.IsTrue(registerResult); } // Act bool result = UserManagementServiceUT.CheckIfIPLocked(ipAddress); // Assert: Check that an IP that is inserted returns true. Assert.IsTrue(result); }