/// <summary>
        /// Unlock the <paramref name="ipAddress"/>.
        /// </summary>
        /// <param name="ipAddress">The ip address to unlock (string)</param>
        /// <returns>Task (bool) wheter the function completed without exception</returns>
        public static bool UnlockIP(string ipAddress)
        {
            // Make the timestamp locked and registration failures have no value.
            IPAddressRecord record = new IPAddressRecord(ipAddress, timestampLocked: Constants.NoValueLong, registrationFailures: Constants.NoValueInt);

            // Call the update funciton of the IP DAO with the record.
            return(_ipDAO.Update(record));
        }
        public void IPAddressDAO_Update_UnsuccessfulUpdate(string ip, long timestampLocked, int registrationFailures,
                                                           long lastRegFailTimestamp)
        {
            // Arrange

            UnitTestIPAddressDAO ipDAO = new UnitTestIPAddressDAO();
            // Create the IP.
            IPAddressRecord ipRecord =
                new IPAddressRecord(ip, timestampLocked, registrationFailures, lastRegFailTimestamp);

            ipDAO.Create(ipRecord);

            // Prepare a new data to update but with a wrong IP address.
            IPAddressRecord updatedRecord = new IPAddressRecord(NonExistingIP, 1, 1, 1);
            bool            result        = false;

            // Act

            try
            {
                // Update the IP address.
                ipDAO.Update(updatedRecord);
            }
            catch (Exception)
            {
                // Catch the exception and set the result to true.
                result = true;
            }

            // Assert

            // The result should be true.
            Assert.IsTrue(result);
        }
        public void IPAddressDAO_Update_SuccessfulUpdate(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);

            // Prepare a new data to update.
            IPAddressRecord updatedRecord = new IPAddressRecord(ip, 1, 1, 1);

            // Act

            // Update the data of the IP.
            ipDAO.Update(updatedRecord);
            // Read the IP.
            IPAddressObject ipObject = (IPAddressObject)ipDAO.ReadById(ip);
            // Check if the IP was updated correctly and set the result to true.
            bool result = DataEquals(ipRecord, ipObject);

            // Assert

            // The result should be true.
            Assert.IsTrue(result);
        }