public void CustomSerializePropertyName() { var poco = new TestDepartment { Name = "test" }; var entity = ObjectEntityMapper.ConvertObjectToEntity(poco); Assert.IsFalse(entity.Properties.ContainsKey("Name")); Assert.IsTrue(entity.Properties.ContainsKey("departmentName")); }
public void IgnoreProperty() { var poco = new TestDepartment { PhoneNumber = "555", Code = 123 }; var entity = ObjectEntityMapper.ConvertObjectToEntity(poco); Assert.IsFalse(entity.Properties.ContainsKey("Code")); Assert.IsTrue(entity.Properties.ContainsKey("PhoneNumber")); }
public void ObjectToEntityWithEntityProperty() { var poco = new TestDepartment { Code = 123, Director = new TestPerson { FirstName = "Boss" } }; var entity = ObjectEntityMapper.ConvertObjectToEntity(poco); var value = entity.Properties["Director"].Values[0].EntityValue; string firstName = value.Properties["FirstName"].Values[0].StringValue; Assert.AreEqual("Boss", firstName); }
public void StoreAndLookupObjectWithChildEntity() { var unique = Guid.NewGuid().ToString(); var poco = new TestDepartment { Id = unique, Code = 123, Director = new TestPerson { FirstName = "Boss" } }; using (var session = _datastore.OpenSession()) { session.Store(poco); session.SaveChanges(); var lookupPoco = session.Load<TestDepartment>(unique); Assert.AreEqual("Boss", lookupPoco.Director.FirstName); } }