コード例 #1
0
        public void TestOnAllProperties()
        {
            Type c   = typeof(IClassC);
            var  res = FactoryMapper.GetPropertiesOf(c);

            Assert.AreEqual(4, res.Length);
        }
コード例 #2
0
        public void AllPropertiesFromTree()
        {
            Type t0 = typeof(MyDerivedClass);
            const BindingFlags flags = BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance;
            var prop = this.GetPropertiesFromDeclaredType(FactoryMapper.GetPropertiesOf(t0, flags), flags).ToArray();

            Assert.NotNull(prop);
            Assert.AreEqual(4, prop.Length);

            Assert.AreEqual(4, prop.Count(n => (n.GetSetMethod() ?? n.GetSetMethod(true)) != null));
        }