public void DirectTypeAttributeDefinedTest() { TypeReflections.IsAttributeDefined(ModelWithAttr, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ModelWithAttr, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(PropertyForModelWithAttr, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(PropertyForModelWithAttr, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWithAttr, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWithAttr, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWithAttr, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWithAttr, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ConstructorForModelWithAttrWithoutParam, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ConstructorForModelWithAttrWithoutParam, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ConstructorForModelWithAttrWithOneParam, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWithAttrWithOneParam, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWithAttrWithOneParam, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWithAttrWithOneParam, AttributeTwo).ShouldBeTrue(); Types.IsAttributeDefined(ModelWithAttr, AttributeOne).ShouldBeTrue(); Types.IsAttributeDefined(ModelWithAttr, AttributeTwo).ShouldBeFalse(); }
public void GenericTypeAttributeNotDefinedTest() { TypeReflections.IsAttributeDefined <ModelOneAttribute>(ModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(PropertyForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(PropertyForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(FieldForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(FieldForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(MethodForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(MethodForModelWithoutAttr).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWithoutAttrWithoutParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWithoutAttrWithoutParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWithoutAttrWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWithoutAttrWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ParameterOfConstructorForModelWithoutAttrWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ParameterOfConstructorForModelWithoutAttrWithOneParam).ShouldBeFalse(); Types.IsAttributeDefined <ModelOneAttribute>(ModelWithoutAttr).ShouldBeFalse(); Types.IsAttributeDefined <ModelTwoAttribute>(ModelWithoutAttr).ShouldBeFalse(); Types.IsAttributeDefined <NormalWithoutAttrClass, ModelOneAttribute>().ShouldBeFalse(); Types.IsAttributeDefined <NormalWithoutAttrClass, ModelTwoAttribute>().ShouldBeFalse(); }
public void GenericTypeInheritAttributeDefinedTest() { TypeReflections.IsAttributeDefined <ModelOneAttribute>(ModelWrapper).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ModelWrapper).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelThreeAttribute>(ModelWrapper).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelThreeAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(PropertyForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(PropertyForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(PropertyForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(PropertyForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(FieldForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(FieldForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(FieldForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(FieldForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(MethodForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(MethodForModelWrapper).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(MethodForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(MethodForModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWrapperWithoutParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWrapperWithoutParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWrapperWithoutParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWrapperWithoutParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWrapperWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWrapperWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ConstructorForModelWrapperWithOneParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ConstructorForModelWrapperWithOneParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ParameterOfConstructorForModelWrapperWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ParameterOfConstructorForModelWrapperWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelThreeAttribute>(ParameterOfConstructorForModelWrapperWithOneParam).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelOneAttribute>(ParameterOfConstructorForModelWrapperWithOneParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelTwoAttribute>(ParameterOfConstructorForModelWrapperWithOneParam, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined <ModelThreeAttribute>(ParameterOfConstructorForModelWrapperWithOneParam, ReflectionOptions.Inherit).ShouldBeFalse(); Types.IsAttributeDefined <ModelOneAttribute>(ModelWrapper).ShouldBeFalse(); Types.IsAttributeDefined <ModelTwoAttribute>(ModelWrapper).ShouldBeFalse(); Types.IsAttributeDefined <ModelThreeAttribute>(ModelWrapper).ShouldBeFalse(); Types.IsAttributeDefined <ModelOneAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); Types.IsAttributeDefined <ModelTwoAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeFalse(); Types.IsAttributeDefined <ModelThreeAttribute>(ModelWrapper, ReflectionOptions.Inherit).ShouldBeTrue(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelOneAttribute>().ShouldBeFalse(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelTwoAttribute>().ShouldBeFalse(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelThreeAttribute>().ShouldBeFalse(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelOneAttribute>(ReflectionOptions.Inherit).ShouldBeTrue(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelTwoAttribute>(ReflectionOptions.Inherit).ShouldBeFalse(); Types.IsAttributeDefined <NormalWithAttrClassWrapper, ModelThreeAttribute>(ReflectionOptions.Inherit).ShouldBeTrue(); }
public void DirectTypeInheritAttributeDefinedTest() { TypeReflections.IsAttributeDefined(ModelWrapper, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ModelWrapper, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ModelWrapper, AttributeThree).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ModelWrapper, AttributeOne, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ModelWrapper, AttributeTwo, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ModelWrapper, AttributeThree, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(PropertyForModelWrapper, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(PropertyForModelWrapper, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(PropertyForModelWrapper, AttributeOne, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(PropertyForModelWrapper, AttributeTwo, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWrapper, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWrapper, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWrapper, AttributeOne, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(FieldForModelWrapper, AttributeTwo, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWrapper, AttributeOne).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWrapper, AttributeTwo).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWrapper, AttributeOne, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(MethodForModelWrapper, AttributeTwo, ReflectionOptions.Inherit).ShouldBeTrue(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithoutParam, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithoutParam, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithoutParam, AttributeOne, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithoutParam, AttributeTwo, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithOneParam, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithOneParam, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithOneParam, AttributeOne, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ConstructorForModelWrapperWithOneParam, AttributeTwo, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeOne).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeTwo).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeThree).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeOne, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeTwo, ReflectionOptions.Inherit).ShouldBeFalse(); TypeReflections.IsAttributeDefined(ParameterOfConstructorForModelWrapperWithOneParam, AttributeThree, ReflectionOptions.Inherit).ShouldBeFalse(); Types.IsAttributeDefined(ModelWrapper, AttributeOne).ShouldBeFalse(); Types.IsAttributeDefined(ModelWrapper, AttributeTwo).ShouldBeFalse(); Types.IsAttributeDefined(ModelWrapper, AttributeThree).ShouldBeFalse(); Types.IsAttributeDefined(ModelWrapper, AttributeOne, ReflectionOptions.Inherit).ShouldBeTrue(); Types.IsAttributeDefined(ModelWrapper, AttributeTwo, ReflectionOptions.Inherit).ShouldBeFalse(); Types.IsAttributeDefined(ModelWrapper, AttributeThree, ReflectionOptions.Inherit).ShouldBeTrue(); }