public void Attributes()
 {
     var v = new ReflectionClassMapping(typeof(MySample));
     PropertyInfo lpi = typeof(MySample).GetProperty("Str");
     var ma = v.GetMemberAttributes(lpi);
     Assert.That(ma.Count(), Is.EqualTo(1));
     Assert.That(ma.First(), Is.InstanceOf<IsNumericAttribute>());
     Assert.That(ma.OfType<IsNumericAttribute>().First().Message, Is.EqualTo("Must be a number"));
 }
        public void Members()
        {
            ReflectionClassMapping rm = new ReflectionClassMapping(typeof (Address));
            List<MemberInfo> mi = new List<MemberInfo>(rm.GetMembers());
            Assert.AreEqual(16, mi.Count);

            rm = new ReflectionClassMapping(typeof(Polimorphism.DerivatedClass));
            mi = new List<MemberInfo>(rm.GetMembers());
            Assert.AreEqual(1, mi.Count);
        }
        public void ClassAttributes()
        {
            ReflectionClassMapping rm = new ReflectionClassMapping(typeof (Address));
            List<Attribute> mi = new List<Attribute>(rm.GetClassAttributes());
            Assert.AreEqual(0, mi.Count);

            rm = new ReflectionClassMapping(typeof (Suricato));
            mi = new List<Attribute>(rm.GetClassAttributes());
            Assert.AreEqual(1, mi.Count);
        }
        public void MemberAttributes()
        {
            ReflectionClassMapping rm = new ReflectionClassMapping(typeof (Address));
            MemberInfo mi = typeof (Address).GetField("floor");
            List<Attribute> mas = new List<Attribute>(rm.GetMemberAttributes(mi));
            Assert.AreEqual(1, mas.Count);

            mi = typeof (Address).GetProperty("Zip");
            mas = new List<Attribute>(rm.GetMemberAttributes(mi));
            Assert.AreEqual(3, mas.Count);

            mi = typeof (Address).GetProperty("Id");
            mas = new List<Attribute>(rm.GetMemberAttributes(mi));
            Assert.AreEqual(3, mas.Count);
        }
 public void GetEntityType()
 {
     ReflectionClassMapping rm = new ReflectionClassMapping(typeof (Address));
     Assert.AreEqual(typeof (Address), rm.EntityType);
 }