/// <summary>
        /// Validates that the parameter has the expected length. Otherwise, an <see cref="ArgumentException" /> is thrown.
        /// </summary>
        /// <param name="validator">The <see cref="ParameterValidator{TParameter}" />.</param>
        /// <param name="expectedLength">The expected length.</param>
        /// <returns>The same instance of <see cref="ParameterValidator{TParameter}" />.</returns>
        /// <exception cref="ArgumentException">Thrown when the parameter length is not equal to <paramref name="expectedLength" />.</exception>
        public static ParameterValidator <string> HasLength(this ParameterValidator <string> validator, int expectedLength)
        {
            if (validator.Value == null)
            {
                return(validator);
            }

            string exceptionMessage = string.Format(ExceptionMessages.VALUE_MUST_HAVE_LENGTH_EQUAL_TO, expectedLength.ToString());

            return(validator.HasLength(expectedLength, exceptionMessage));
        }