예제 #1
0
        public static Twin CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Twin entity = new rt.srz.model.srz.Twin();

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


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

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

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

            return(entity);
        }
예제 #2
0
        public void Create()
        {
            try
            {
                rt.srz.model.srz.Twin entity = CreateNew();

                object result = manager.Save(entity);

                Assert.IsNotNull(result);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
예제 #3
0
        public void Read()
        {
            try
            {
                rt.srz.model.srz.Twin entityA = CreateNew();
                manager.Save(entityA);

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

                Assert.AreEqual(entityA, entityB);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
예제 #4
0
        public void Delete()
        {
            try
            {
                rt.srz.model.srz.Twin entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Twin entity = GetFirstTwin();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }