Exemple #1
0
 public string GetLongName(ILongNameArgument arg)
 {
     return(GetLongName(arg, String.Format(
                            "Long name {0} is not allowed. {1}",
                            arg.LongName,
                            ArgumentValidation.IsAllowedLongNameExplanation)));
 }
Exemple #2
0
        public string GetLongName(ILongNameArgument arg, string errorMessage)
        {
            if (arg.LongName != null)
            {
                if (arg.LongName.Length < 2)
                {
                    throw new ArgumentIntegrityException(String.Format(
                                                             "Long argument {0} must have at least two characters.",
                                                             arg.LongName));
                }
                if (!ArgumentValidation.IsAllowedLongName(arg.LongName))
                {
                    throw new ArgumentIntegrityException(errorMessage);
                }
                return(arg.LongName);
            }

            return(null);
        }