コード例 #1
0
        [Ignore] // TODO: Known issue - we don't copy attributes yet
        public void ProxyPropertyReflectionReturnsAttributes()
        {
            IInstanceInterceptor interceptor = new InterfaceInterceptor();
            HasSomeProperties    target      = new HasSomeProperties();
            IInterceptingProxy   proxy       = interceptor.CreateProxy(typeof(IHaveSomeProperties), target);

            PropertyInfo    nameProp = proxy.GetType().GetProperty("Name");
            SampleAttribute attr     = (SampleAttribute)Attribute.GetCustomAttribute(nameProp, typeof(SampleAttribute));

            Assert.AreEqual("A name", attr.Name);
        }
コード例 #2
0
        public void ReflectingOverProxyTypeReturnsProperties()
        {
            IInstanceInterceptor interceptor = new InterfaceInterceptor();
            HasSomeProperties    target      = new HasSomeProperties();
            IInterceptingProxy   proxy       = interceptor.CreateProxy(typeof(IHaveSomeProperties), target);

            List <PropertyInfo> interfaceProperties = new List <PropertyInfo>(typeof(IHaveSomeProperties).GetProperties());
            List <PropertyInfo> proxyProperties     = new List <PropertyInfo>(proxy.GetType().GetProperties());

            Assert.AreEqual(interfaceProperties.Count, proxyProperties.Count);
        }