コード例 #1
0
        public void GetCustomAttributeData()
        {
            var customAttributes = new[] { CustomAttributeDeclarationObjectMother.Create() };
            var member           = MethodOnTypeInstantiationObjectMother.Create();
            var parameter        = CustomParameterInfoObjectMother.Create(member, customAttributes: customAttributes);

            var parameterInstantiation = new MemberParameterOnInstantiation(member, parameter);

            Assert.That(parameterInstantiation.GetCustomAttributeData(), Is.EqualTo(customAttributes));
        }
コード例 #2
0
        public void SetUp()
        {
            _declaringType = TypeInstantiationObjectMother.Create();
            _originalEvent = GetType().GetEvent("Event");
            _addMethod     = MethodOnTypeInstantiationObjectMother.Create(_declaringType, GetType().GetMethod("add_Event"));
            _removeMethod  = MethodOnTypeInstantiationObjectMother.Create(_declaringType, GetType().GetMethod("remove_Event"));
            _raiseMethod   = MethodOnTypeInstantiationObjectMother.Create(_declaringType, GetType().GetMethod("RaiseMethod"));

            _event = new EventOnTypeInstantiation(_declaringType, _originalEvent, _addMethod, _removeMethod, _raiseMethod);
        }
コード例 #3
0
        public void SetUp()
        {
            _indexParameter = CustomParameterInfoObjectMother.Create();

            _declaringType    = TypeInstantiationObjectMother.Create();
            _getMethod        = MethodOnTypeInstantiationObjectMother.Create(_declaringType, typeof(GenericType <>).GetMethod("get_Item"));
            _setMethod        = MethodOnTypeInstantiationObjectMother.Create(_declaringType, typeof(GenericType <>).GetMethod("set_Item"));
            _originalProperty = CustomPropertyInfoObjectMother.Create(
                indexParameters: new[] { _indexParameter }, getMethod: _getMethod, setMethod: _setMethod);

            _property = new PropertyOnTypeInstantiation(_declaringType, _originalProperty, _getMethod, _setMethod);
        }
コード例 #4
0
        public void SetUp()
        {
            _typeArgument = ReflectionObjectMother.GetSomeType();

            var genericTypeDefinition = typeof(GenericType <>);

            _genericTypeParameter      = genericTypeDefinition.GetGenericArguments().Single();
            _declaringType             = TypeInstantiationObjectMother.Create(genericTypeDefinition, new[] { _typeArgument });
            _memberOnTypeInstantiation = MethodOnTypeInstantiationObjectMother.Create(_declaringType);

            var genericMethodDefinition = NormalizingMemberInfoFromExpressionUtility.GetGenericMethodDefinition(() => GenericMethod <Dev.T>());

            _genericMethodParameter = genericMethodDefinition.GetGenericArguments().Single();
            _methodInstantiation    = MethodInstantiationObjectMother.Create(genericMethodDefinition, typeArguments: new[] { _typeArgument });
        }