protected rt.srz.model.srz.Statement GetFirstStatement() { IList <rt.srz.model.srz.Statement> entityList = manager.GetAll(1); if (entityList.Count == 0) { Assert.Fail("All tables must have at least one row for unit tests to succeed."); } return(entityList[0]); }
public static MessageStatement CreateNew(int depth = 0) { rt.srz.model.srz.MessageStatement entity = new rt.srz.model.srz.MessageStatement(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.Version = 48; using (rt.srz.business.manager.IConceptManager conceptManager = ObjectFactory.GetInstance <IConceptManager>()) { var all = conceptManager.GetAll(1); Concept entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = ConceptTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.Type = entityRef; } using (rt.srz.business.manager.IMessageManager messageManager = ObjectFactory.GetInstance <IMessageManager>()) { entity.Message = null; } using (rt.srz.business.manager.IStatementManager statementManager = ObjectFactory.GetInstance <IStatementManager>()) { var all = statementManager.GetAll(1); Statement entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = StatementTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.Statement = entityRef; } return(entity); }
public static MedicalInsurance CreateNew(int depth = 0) { rt.srz.model.srz.MedicalInsurance entity = new rt.srz.model.srz.MedicalInsurance(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.PolisSeria = "Test Test Test Te"; entity.PolisNumber = "Test Test Test Test"; entity.DateFrom = System.DateTime.Now; entity.DateTo = System.DateTime.Now; entity.IsActive = true; entity.DateStop = System.DateTime.Now; entity.Enp = "T"; entity.StateDateFrom = System.DateTime.Now; entity.StateDateTo = System.DateTime.Now; using (rt.srz.business.manager.IInsuredPersonManager insuredPersonManager = ObjectFactory.GetInstance <IInsuredPersonManager>()) { entity.InsuredPerson = null; } using (rt.srz.business.manager.IConceptManager conceptManager = ObjectFactory.GetInstance <IConceptManager>()) { var all = conceptManager.GetAll(1); Concept entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = ConceptTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.PolisType = entityRef; } using (rt.srz.business.manager.IOrganisationManager organisationManager = ObjectFactory.GetInstance <IOrganisationManager>()) { var all = organisationManager.GetAll(1); Organisation entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = OrganisationTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.Smo = entityRef; } using (rt.srz.business.manager.IStatementManager statementManager = ObjectFactory.GetInstance <IStatementManager>()) { var all = statementManager.GetAll(1); Statement entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = StatementTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.Statement = entityRef; } return(entity); }