Exemple #1
0
        protected bool Equals(ValidQueueName other)
        {
            if (!object.Equals(this.Value, other.Value))
            {
                return(false);
            }

            return(true);
        }
        public static bool TryParse(string value, out ValidQueueName queueName, out IReadOnlyCollection <string> errorMessages)
        {
            var errorMessageList = new List <string>();

            errorMessages = errorMessageList;

            if (IsEmpty(value))
            {
                // TryParse should never fail, so report null as an error instead of ArgumentNullException.
                errorMessageList.Add("Value required");
            }
            else
            {
                if (value.Length < MinLength || value.Length > MaxLength)
                {
                    errorMessageList.Add(string.Format("Length must be from {0} to {1} characters", MinLength, MaxLength));
                }

                if (value.Any(ForbiddenCharactersHashSet.Contains))
                {
                    errorMessageList.Add(ForbiddenCharacterMessage);
                }
            }

            if (errorMessageList.Count > 0)
            {
                queueName = null;
                return(false);
            }

            queueName = new ValidQueueName
            {
                Value = value
            };

            return(true);
        }
        public static bool TryParse(string value, out ValidQueueName queueName)
        {
            IReadOnlyCollection <string> errorMessages;

            return(TryParse(value, out queueName, out errorMessages));
        }