public void AddAndGet()
 {
     var mgr = new MappingManager();
     mgr.Add(typeof (Entity).GetProperty("Id"), "id");
     var fields = mgr.GetFields(typeof (Entity));
     Assert.AreEqual(1, fields.Count);
 }
Esempio n. 2
0
 public void Add_duplicate_property_overwrites() {
     var mgr = new MappingManager();
     mgr.Add(typeof (Entity).GetProperty("Id"), "id");
     mgr.Add(typeof (Entity).GetProperty("Id"), "id2");
     var fields = mgr.GetFields(typeof (Entity));
     Assert.AreEqual(1, fields.Count);
     Assert.AreEqual("id2", fields.First().Value.FieldName);
 }
 public void No_Mapped_type_returns_empty()
 {
     var mgr = new MappingManager();
     var fields = mgr.GetFields(typeof (Entity));
     Assert.AreEqual(0, fields.Count);
 }
        public void Inherited_gets_id_property_correctly2()
        {
            var mgr = new MappingManager();
            mgr.Add(typeof(InheritedEntity).GetProperty("Id"), "id");

            Assert.IsTrue(mgr.GetFields(typeof(InheritedEntity)).ContainsKey("id"), "InheritedEntity contains id field");
            Assert.IsTrue(mgr.GetFields(typeof(Entity)).ContainsKey("id"), "Entity contains id field");
        }
 public void Inherited()
 {
     var mgr = new MappingManager();
     mgr.Add(typeof(Entity).GetProperty("Id"), "id");
     mgr.Add(typeof(InheritedEntity).GetProperty("Description"), "desc");
     var entityFields = mgr.GetFields(typeof(Entity));
     Assert.AreEqual(1, entityFields.Count);
     var inheritedEntityFields = mgr.GetFields(typeof(InheritedEntity));
     Assert.AreEqual(2, inheritedEntityFields.Count);
 }
 public void GetFields_doesnt_admit_null()
 {
     var mgr = new MappingManager();
     mgr.GetFields(null);
 }
 public void Add_property_only()
 {
     var mgr = new MappingManager();
     var property = typeof (Entity).GetProperty("Id");
     mgr.Add(property);
     var fields = mgr.GetFields(typeof (Entity));
     Assert.AreEqual(1, fields.Count);
     Assert.AreEqual("Id", fields.First().Value.FieldName);
 }