Exemplo n.º 1
0
        public void GetPointcut_AttributeProvider_MethodPointcut()
        {
            var advice    = NormalizingMemberInfoFromExpressionUtility.GetMethod((DomainType obj) => obj.Advice());
            var pointcut1 = CheckPointcut <MethodPointcut> (typeof(DomainType));
            var pointcut2 = CheckPointcut <MethodPointcut> (advice as ICustomAttributeProvider);

            var method = NormalizingMemberInfoFromExpressionUtility.GetMethod(() => DomainType.Method(null));

            Assert.That(pointcut1.Method, Is.EqualTo(method));
            Assert.That(pointcut2.Method, Is.EqualTo(method));
        }
Exemplo n.º 2
0
        public override void SetUp()
        {
            base.SetUp();

            _signedType   = typeof(int);
            _unsignedType = CreateUnsignedType(TypeAttributes.Class, typeof(object));

            _signedInterfaceType   = typeof(IMarkerInterface);
            _unsignedInterfaceType = CreateUnsignedType(TypeAttributes.Interface | TypeAttributes.Abstract, baseType: null);

            _signedDelegateType   = typeof(Action);
            _unsignedDelegateType = typeof(Action <>).MakeGenericType(_unsignedType);

            var attributeCtor = NormalizingMemberInfoFromExpressionUtility.GetConstructor(() => new AbcAttribute(null));

            _signedAttribute   = new CustomAttributeDeclaration(attributeCtor, new object[] { _signedType });
            _unsignedAttribute = new CustomAttributeDeclaration(attributeCtor, new object[] { _unsignedType });

            _signedField   = NormalizingMemberInfoFromExpressionUtility.GetField(() => DomainType.Field);
            _unsignedField = _unsignedType.GetField("field");

            _signedCtor   = NormalizingMemberInfoFromExpressionUtility.GetConstructor(() => new DomainType());
            _unsignedCtor = _unsignedType.GetConstructors().Single();

            _signedMethod   = NormalizingMemberInfoFromExpressionUtility.GetMethod(() => DomainType.Method());
            _unsignedMethod = _unsignedType.GetMethod("method");

            _signedVarArgsMethod   = typeof(DomainType).GetMethod("VarArgsMethod");
            _unsignedVarArgsMethod = _unsignedType.GetMethod("varargs");
        }