Пример #1
0
        private static IValidatorRule Parse(
            IEnumerable <ExtensibleType_Type_Group> rules,
            Dictionary <string, object> objectStorage,
            Enumerations.JunctionEnum junctionEnum) // throws CertificateValidationException
        {
            List <IValidatorRule> ruleList = new List <IValidatorRule>();

            foreach (ExtensibleType_Type_Group rule in rules)
            {
                ruleList.Add(Parse(rule, objectStorage));

                if (junctionEnum == Enumerations.JunctionEnum.AND)
                {
                    return(Junction.And(ruleList.ToArray()));
                }

                if (junctionEnum == Enumerations.JunctionEnum.OR)
                {
                    return(Junction.Or(ruleList.ToArray()));
                }

                // if (junctionEnum == JunctionEnum.XOR)
                return(Junction.Xor(ruleList.ToArray()));
            }

            throw new InvalidOperationException("Rules list cannot be empty");
        }