Exemplo n.º 1
0
        public void EnsureProxyHasAttributesOnClassAndMethods()
        {
            AttributedClass instance = (AttributedClass)
                                       generator.CreateClassProxy(typeof(AttributedClass), new StandardInterceptor());

            object[] attributes = instance.GetType().GetCustomAttributes(typeof(NonInheritableAttribute), false);
            Assert.AreEqual(1, attributes.Length);
            Assert.IsInstanceOf(typeof(NonInheritableAttribute), attributes[0]);

            attributes = instance.GetType().GetMethod("Do1").GetCustomAttributes(typeof(NonInheritableAttribute), false);
            Assert.AreEqual(1, attributes.Length);
            Assert.IsInstanceOf(typeof(NonInheritableAttribute), attributes[0]);
        }
Exemplo n.º 2
0
        public void EnsureProxyHasAttributesOnProperties()
        {
            AttributedClass proxy        = generator.CreateClassProxy <AttributedClass>();
            PropertyInfo    nameProperty = proxy.GetType().GetProperty("Name");

            Assert.IsTrue(nameProperty.IsDefined(typeof(NonInheritableAttribute), false));
        }