public static ValidateTarget <string> IsWhiteSpace([ValidatedNotNull] this ValidateTarget <string> target, Func <string> getErrorMessage = null) { if (target.Value == null || !string.IsNullOrWhiteSpace(target.Value)) { ExceptionFactory.ThrowException(target.Traits.GenericFailureExceptionType, getErrorMessage != null ? getErrorMessage.Invoke() : ErrorMessageFactory.ShouldBeWhiteSpace(target)); } return(target); }