예제 #1
0
        protected rt.srz.model.srz.Oid GetFirstOid()
        {
            IList <rt.srz.model.srz.Oid> 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 Organisation CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Organisation entity = new rt.srz.model.srz.Organisation();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = System.Guid.NewGuid();

            entity.IsActive            = true;
            entity.IsOnLine            = true;
            entity.Code                = "123";
            entity.FullName            = "Test Test ";
            entity.ShortName           = "Test Test ";
            entity.Inn                 = "Test Tes";
            entity.Ogrn                = "Test Test Test T";
            entity.Postcode            = "Te";
            entity.LastName            = "Test Test ";
            entity.FirstName           = "Test Test ";
            entity.MiddleName          = "Test Test ";
            entity.Phone               = "Test Test ";
            entity.Fax                 = "Test Test ";
            entity.EMail               = "Test Test ";
            entity.Website             = "Test Test ";
            entity.LicenseData         = "Test Test ";
            entity.LicenseNumber       = "Test";
            entity.DateLicensing       = System.DateTime.Now;
            entity.DateExpiryLicense   = System.DateTime.Now;
            entity.IsSubordination     = true;
            entity.DateIncludeRegister = System.DateTime.Now;
            entity.DateExcludeRegister = System.DateTime.Now;
            entity.HasActivePolicy     = true;
            entity.DateNotification    = System.DateTime.Now;
            entity.CountInsured        = 45;
            entity.DateLastEdit        = System.DateTime.Now;
            entity.Okato               = "Tes";
            entity.TimeRunFrom         = System.DateTime.Now;
            entity.TimeRunTo           = System.DateTime.Now;
            entity.Address             = "Test Test ";

            using (rt.srz.business.manager.IOidManager oidManager = ObjectFactory.GetInstance <IOidManager>())
            {
                var all       = oidManager.GetAll(1);
                Oid entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

                if (entityRef == null && depth < 3)
                {
                    depth++;
                    entityRef = OidTests.CreateNew(depth);
                    ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef);
                }

                entity.Oid = entityRef;
            }

            using (rt.srz.business.manager.IOrganisationManager organisationMember1Manager = ObjectFactory.GetInstance <IOrganisationManager>())
            {
                entity.Parent = null;
            }

            using (rt.srz.business.manager.IOrganisationManager organisationMember2Manager = ObjectFactory.GetInstance <IOrganisationManager>())
            {
                entity.ChangedRow = null;
            }

            using (rt.srz.business.manager.IConceptManager concept1Manager = ObjectFactory.GetInstance <IConceptManager>())
            {
                entity.CauseRegistration = null;
            }

            using (rt.srz.business.manager.IConceptManager concept2Manager = ObjectFactory.GetInstance <IConceptManager>())
            {
                entity.CauseExclusion = null;
            }

            return(entity);
        }