protected rt.srz.model.srz.QueryResponse GetFirstQueryResponse() { IList <rt.srz.model.srz.QueryResponse> 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 QueryResponseItemize CreateNew(int depth = 0) { rt.srz.model.srz.QueryResponseItemize entity = new rt.srz.model.srz.QueryResponseItemize(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); using (rt.srz.business.manager.IQueryResponseManager queryResponseManager = ObjectFactory.GetInstance <IQueryResponseManager>()) { var all = queryResponseManager.GetAll(1); QueryResponse entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = QueryResponseTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.QueryResponse = entityRef; } using (rt.srz.business.manager.ISearchKeyTypeManager searchKeyTypeManager = ObjectFactory.GetInstance <ISearchKeyTypeManager>()) { var all = searchKeyTypeManager.GetAll(1); SearchKeyType entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = SearchKeyTypeTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.KeyType = entityRef; } return(entity); }
public static In1 CreateNew(int depth = 0) { rt.srz.model.srz.In1 entity = new rt.srz.model.srz.In1(); // You may need to maually enter this key if there is a constraint violation. entity.Id = System.Guid.NewGuid(); entity.Number = default(Int16); entity.PolisSeria = "Te"; entity.PolisNumber = "Test Test Te"; entity.DateFrom = System.DateTime.Now; entity.DateTo = System.DateTime.Now; entity.DateStop = System.DateTime.Now; using (rt.srz.business.manager.IQueryResponseManager queryResponseManager = ObjectFactory.GetInstance <IQueryResponseManager>()) { var all = queryResponseManager.GetAll(1); QueryResponse entityRef = null; if (all.Count > 0) { entityRef = all[0]; } if (entityRef == null && depth < 3) { depth++; entityRef = QueryResponseTests.CreateNew(depth); ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef); } entity.QueryResponse = entityRef; } 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; } return(entity); }