コード例 #1
0
        protected rt.srz.model.srz.SearchKeyType GetFirstSearchKeyType()
        {
            IList <rt.srz.model.srz.SearchKeyType> 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]);
        }
コード例 #2
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);
        }