Пример #1
0
        public void Create()
        {
            try
            {
                rt.srz.model.srz.Statement entity = CreateNew();

                object result = manager.Save(entity);

                Assert.IsNotNull(result);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Пример #2
0
        public void Read()
        {
            try
            {
                rt.srz.model.srz.Statement entityA = CreateNew();
                manager.Save(entityA);

                rt.srz.model.srz.Statement entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA, entityB);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Пример #3
0
        public void Delete()
        {
            try
            {
                rt.srz.model.srz.Statement entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Statement entity = GetFirstStatement();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Пример #4
0
        public void Update()
        {
            try
            {
                rt.srz.model.srz.Statement entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Statement entityA = GetFirstStatement();

                entityA.DateFiling = System.DateTime.Now;

                manager.Update(entityA);

                rt.srz.model.srz.Statement entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA.DateFiling, entityB.DateFiling);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Пример #5
0
        public static Statement CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Statement entity = new rt.srz.model.srz.Statement();

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

            entity.DateFiling       = System.DateTime.Now;
            entity.HasPetition      = true;
            entity.NumberPolicy     = "Test";
            entity.AbsentPrevPolicy = true;
            entity.IsActive         = true;
            entity.PolicyIsIssued   = true;
            entity.PrzBuffId        = 19;
            entity.PidId            = 31;
            entity.PolisId          = 90;
            entity.IsExportTemp     = true;
            entity.IsExportPolis    = true;
            entity.PrzBuffPolisId   = 9;
            entity.Version          = 16;
            entity.UserId           = new Guid("01000000-0000-0000-0000-000000000000");

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

            using (rt.srz.business.manager.IStatementManager statementMemberManager = ObjectFactory.GetInstance <IStatementManager>())
            {
                entity.PreviousStatement = null;
            }

            using (rt.srz.business.manager.IConceptManager concept1Manager = ObjectFactory.GetInstance <IConceptManager>())
            {
                var     all       = concept1Manager.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.Status = entityRef;
            }

            using (rt.srz.business.manager.IInsuredPersonDatumManager insuredPersonDatumManager = ObjectFactory.GetInstance <IInsuredPersonDatumManager>())
            {
                entity.InsuredPersonData = null;
            }

            using (rt.srz.business.manager.IInsuredPersonManager insuredPersonManager = ObjectFactory.GetInstance <IInsuredPersonManager>())
            {
                entity.InsuredPerson = null;
            }

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

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

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

            using (rt.srz.business.manager.IDocumentManager document1Manager = ObjectFactory.GetInstance <IDocumentManager>())
            {
                entity.DocumentUdl = null;
            }

            using (rt.srz.business.manager.IContactInfoManager contactInfoManager = ObjectFactory.GetInstance <IContactInfoManager>())
            {
                entity.ContactInfo = null;
            }

            using (rt.srz.business.manager.IRepresentativeManager representativeManager = ObjectFactory.GetInstance <IRepresentativeManager>())
            {
                entity.Representative = null;
            }

            using (rt.srz.business.manager.IDocumentManager document2Manager = ObjectFactory.GetInstance <IDocumentManager>())
            {
                entity.ResidencyDocument = null;
            }

            using (rt.srz.business.manager.IaddressManager address1Manager = ObjectFactory.GetInstance <IaddressManager>())
            {
                entity.Address = null;
            }

            using (rt.srz.business.manager.IDocumentManager document3Manager = ObjectFactory.GetInstance <IDocumentManager>())
            {
                entity.DocumentRegistration = null;
            }

            using (rt.srz.business.manager.IaddressManager address2Manager = ObjectFactory.GetInstance <IaddressManager>())
            {
                entity.Address2 = null;
            }

            return(entity);
        }