public void JoinedSubClass_WithAnyProperty() { ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Entity), typeof(CompanyEntity), typeof(PersonEntity), typeof(ManagerEntity)); Recreate(); Entity.DeleteAll(); CompanyEntity.DeleteAll(); PersonEntity.DeleteAll(); ManagerEntity.DeleteAll(); ManagerEntity manager = new ManagerEntity(); manager.Name = "pointy haired"; manager.Save(); PersonEntity person = new PersonEntity(); person.Name = "dilbert"; person.Manager = manager; person.Save(); PersonEntity[] people = PersonEntity.FindAll(); Assert.AreEqual(1, people.Length); Assert.IsNotNull(people[0].Manager); }
public void Entities() { ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Entity), typeof(CompanyEntity), typeof(PersonEntity)); Recreate(); Entity.DeleteAll(); CompanyEntity.DeleteAll(); PersonEntity.DeleteAll(); Entity ent = new Entity(); ent.Name = "MS"; ent.Save(); CompanyEntity ce = new CompanyEntity(); ce.Name = "Keldor"; ce.CompanyType = 1; ce.Save(); Entity[] ents = Entity.FindAll(); Assert.AreEqual(2, ents.Length); CompanyEntity[] ces = CompanyEntity.FindAll(); Assert.AreEqual(1, ces.Length); PersonEntity[] pes = PersonEntity.FindAll(); Assert.AreEqual(0, pes.Length); Assert.AreEqual(ce.CompId, ces[0].CompId); Assert.AreEqual(ce.Name, ces[0].Name); Assert.AreEqual(ce.Id, ces[0].Id); }