示例#1
0
        public static RequirementBase <TType[]> IsNotEmpty <TType>(this RequirementBase <TType[]> requirement)
        {
            if (requirement.ParameterValue.Length == 0)
            {
                throw new ArgumentException(string.Format("Sequence \"{0}\" contains no elements", requirement.ParameterName));
            }

            return(requirement);
        }
示例#2
0
        public static RequirementBase <Guid> IsNotNullOrEmpty(this RequirementBase <Guid> requirement)
        {
            if (requirement == null)
            {
                throw new ArgumentException("requirement");
            }

            if (requirement.ParameterValue == Guid.Empty)
            {
                throw new ArgumentException(requirement.ParameterName);
            }

            return(requirement);
        }
示例#3
0
        public static RequirementBase <string> IsNotNullOrEmpty(this RequirementBase <string> requirement)
        {
            if (requirement == null)
            {
                throw new ArgumentNullException("requirement");
            }

            if (string.IsNullOrEmpty(requirement.ParameterValue))
            {
                throw new ArgumentNullException(requirement.ParameterName);
            }

            return(requirement);
        }
示例#4
0
        public static RequirementBase <IEnumerable <TType> > IsNotEmpty <TType>(this RequirementBase <IEnumerable <TType> > requirement)
        {
            if (requirement == null)
            {
                throw new ArgumentNullException("requirement");
            }

            if (!requirement.ParameterValue.Any())
            {
                throw new Exception("Sequence contains no elements");
            }

            return(requirement);
        }