public TRuleTypeShouldConjunction DoNotHaveAnyAttributes(Attribute firstAttribute,
                                                          params Attribute[] moreAttributes)
 {
     _ruleCreator.ContinueComplexCondition(
         ObjectPredicatesDefinition <TReferenceType> .DoNotHaveAnyAttributes(firstAttribute, moreAttributes));
     return(Create <TRuleTypeShouldConjunction, TRuleType>(_ruleCreator));
 }
Example #2
0
        public static void AttributeDependencyAsExpected(IMember targetMember, Class expectedAttributeClass)
        {
            //Precondition Checks
            if (targetMember == null)
            {
                throw new ArgumentNullException(nameof(targetMember));
            }

            if (expectedAttributeClass == null)
            {
                throw new ArgumentNullException(nameof(expectedAttributeClass));
            }

            //Arrange, Act
            var expectedAttribute = new Attribute(expectedAttributeClass);

            var expectedAttributeDependency =
                new AttributeMemberDependency(targetMember, expectedAttribute);

            //Assert
            Assert.Equal(expectedAttributeDependency,
                         targetMember.Dependencies.First());

            Assert.True(targetMember.Dependencies.Contains(expectedAttributeDependency));
        }
 public TGivenRuleTypeConjunction DoNotHaveAnyAttributes(Attribute firstAttribute,
                                                         params Attribute[] moreAttributes)
 {
     _ruleCreator.AddPredicate(
         ObjectPredicatesDefinition <TRuleType> .DoNotHaveAnyAttributes(firstAttribute, moreAttributes));
     return(Create <TGivenRuleTypeConjunction, TRuleType>(_ruleCreator));
 }
Example #4
0
 public TRuleTypeShouldConjunction NotHaveAnyAttributes(Attribute firstAttribute,
                                                        params Attribute[] moreAttributes)
 {
     _ruleCreator.AddCondition(
         ObjectConditionsDefinition <TRuleType> .NotHaveAnyAttributes(firstAttribute, moreAttributes));
     return(Create <TRuleTypeShouldConjunction, TRuleType>(_ruleCreator));
 }
        public static IPredicate <T> OnlyHaveAttributes(Attribute firstAttribute, params Attribute[] moreAttributes)
        {
            var attributes = new List <Attribute> {
                firstAttribute
            };

            attributes.AddRange(moreAttributes);
            return(OnlyHaveAttributes(attributes));
        }
Example #6
0
        public static void AttributeDependencyAsExpected(IType targetType, Class expectedAttributeClass)
        {
            //Precondition Checks
            if (targetType == null)
            {
                throw new ArgumentNullException(nameof(targetType));
            }

            if (expectedAttributeClass == null)
            {
                throw new ArgumentNullException(nameof(expectedAttributeClass));
            }

            //Arrange, Act
            var expectedAttribute = new Attribute(expectedAttributeClass);

            var expectedAttributeDependency =
                new AttributeTypeDependency(targetType, new TypeInstance <Attribute>(expectedAttribute));

            //Assert
            Assert.True(targetType.HasDependency(expectedAttributeDependency));
        }
Example #7
0
        public static void MemberAttributeAsExpected(IMember targetMember, Class expectedAttributeType,
                                                     Attribute actualAttribute)
        {
            //Precondition Checks
            if (targetMember == null)
            {
                throw new ArgumentNullException(nameof(targetMember));
            }

            if (expectedAttributeType == null)
            {
                throw new ArgumentNullException(nameof(expectedAttributeType));
            }

            if (actualAttribute == null)
            {
                throw new ArgumentNullException(nameof(actualAttribute));
            }

            //Assert
            Assert.Contains(actualAttribute, targetMember.Attributes);

            Assert.Equal(expectedAttributeType.Type, actualAttribute.Type);
        }
Example #8
0
        public static void TypeAttributeAsExpected <TTargetType>(TTargetType targetType, Class expectedAttributeType,
                                                                 Attribute actualAttribute) where TTargetType : IType
        {
            //Precondition Checks
            if (targetType == null)
            {
                throw new ArgumentNullException(nameof(targetType));
            }

            if (expectedAttributeType == null)
            {
                throw new ArgumentNullException(nameof(expectedAttributeType));
            }

            if (actualAttribute == null)
            {
                throw new ArgumentNullException(nameof(actualAttribute));
            }

            //Assert
            Assert.Contains(actualAttribute, targetType.Attributes);

            Assert.Equal(expectedAttributeType.Type, actualAttribute.Type);
        }