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]); }
public void EnsureProxyHasAttributesOnProperties() { AttributedClass proxy = generator.CreateClassProxy <AttributedClass>(); PropertyInfo nameProperty = proxy.GetType().GetProperty("Name"); Assert.IsTrue(nameProperty.IsDefined(typeof(NonInheritableAttribute), false)); }