コード例 #1
0
        public ParamRule Build()
        {
            var rule = new ParamRule();

            if (_areForbidden.HasValue)
            {
                rule.AddItem(RuleType.AreForbidden, _areForbidden);
            }
            if (_validAttributes.Any())
            {
                rule.AddItem(RuleType.ValidAttributes, _validAttributes);
            }
            if (_forbiddenAttributes.Any())
            {
                rule.AddItem(RuleType.InValidAttributes, _forbiddenAttributes);
            }
            if (_hasGetter != null)
            {
                rule.AddItem(RuleType.HasGetter, _hasGetter);
            }
            if (_hasSetter != null)
            {
                rule.AddItem(RuleType.HasSetter, _hasSetter);
            }
            rule.AddMany(((NameParam)_nameParam).Build());
            return(rule);
        }
コード例 #2
0
ファイル: MethodParam.cs プロジェクト: Przemko92/CodeInspect
        public ParamRule Build()
        {
            var rule = new ParamRule();

            if (_areForbidden.HasValue)
            {
                rule.AddItem(RuleType.AreForbidden, _areForbidden);
            }
            if (_validAttributes.Any())
            {
                rule.AddItem(RuleType.ValidAttributes, _validAttributes);
            }
            if (_forbiddenAttributes.Any())
            {
                rule.AddItem(RuleType.InValidAttributes, _forbiddenAttributes);
            }
            if (_areVoid.HasValue)
            {
                rule.AddItem(RuleType.AreVoid, _areVoid);
            }
            if (_minArgsCount.HasValue)
            {
                rule.AddItem(RuleType.HasMoreArgsThan, _minArgsCount);
            }
            if (_maxArgsCount.HasValue)
            {
                rule.AddItem(RuleType.HasLessArgsThan, _maxArgsCount);
            }
            rule.AddMany(((NameParam)_nameParam).Build());
            rule.AddMany(((ArgsNameParam)_argsNameParam).Build());
            return(rule);
        }
コード例 #3
0
ファイル: TypeParam.cs プロジェクト: Przemko92/CodeInspect
        public ParamRule Build()
        {
            var rule = new ParamRule();

            if (_areForbidden.HasValue)
            {
                rule.AddItem(RuleType.AreForbidden, _areForbidden);
            }
            if (_validAttributes.Any())
            {
                rule.AddItem(RuleType.ValidAttributes, _validAttributes);
            }
            if (_forbiddenAttributes.Any())
            {
                rule.AddItem(RuleType.InValidAttributes, _forbiddenAttributes);
            }
            if (_inherits != null)
            {
                rule.AddItem(RuleType.Inherits, _inherits);
            }
            if (_implementTypes.Any())
            {
                rule.AddItem(RuleType.Implements, _implementTypes);
            }
            if (_maxAllowedMethods.HasValue)
            {
                rule.AddItem(RuleType.MaxMethods, _maxAllowedMethods);
            }
            if (_maxAllowedProperties.HasValue)
            {
                rule.AddItem(RuleType.MaxProperties, _maxAllowedProperties);
            }
            if (_hasPublicConstructor != null)
            {
                rule.AddItem(RuleType.HasPublicConstructor, _hasPublicConstructor);
            }
            if (_defaultConstructorOptions != null)
            {
                rule.AddItem(RuleType.DefaultConstructor, _defaultConstructorOptions);
            }
            rule.AddMany(((NameParam)_nameParam).Build());
            return(rule);
        }