public void IPAddressDAO_DeleteByIds_SuccessfulDeletion(string ip, long timestampLocked, int registrationFailures, long lastRegFailTimestamp) { // Arrange UnitTestIPAddressDAO ipDAO = new UnitTestIPAddressDAO(); // Create an IP address. IPAddressRecord ipRecord = new IPAddressRecord(ip, timestampLocked, registrationFailures, lastRegFailTimestamp); ipDAO.Create(ipRecord); // Act // Delete the IP address. ipDAO.DeleteByIds(new List <string>() { ip }); // Check if the IP exists and set the result accordingly. bool result = ipDAO.CheckIPExistence(ip); // Assert // The result should be false. Assert.IsFalse(result); }
public void IPAddressDAO_CheckIPExistence_IPNonExists(string ip, long timestampLocked, int registrationFailures, long lastRegFailTimestamp) { // Arrange UnitTestIPAddressDAO ipDAO = new UnitTestIPAddressDAO(); // Create an IP. IPAddressRecord ipRecord = new IPAddressRecord(ip, timestampLocked, registrationFailures, lastRegFailTimestamp); ipDAO.Create(ipRecord); // Act // Check if the IP exists and set the result accordingly. bool result = ipDAO.CheckIPExistence(NonExistingIP); // Assert // The result should be false. Assert.IsFalse(result); }
/// <summary> /// Checks if the <paramref name="ipAddress"/> exists in the data store. /// </summary> /// <param name="ipAddress">ip address to check (string)</param> /// <returns>Task (bool) whether the function completed without exception</returns> public static bool CheckIPExistence(string ipAddress) { // Call the check method via the IP DAO with the ip address. return(_ipDAO.CheckIPExistence(ipAddress)); }