예제 #1
0
        public void Create()
        {
            try
            {
                rt.srz.model.srz.Concept 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.Concept entityA = CreateNew();
                manager.Save(entityA);

                rt.srz.model.srz.Concept 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.Concept entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Concept entity = GetFirstConcept();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
예제 #4
0
        public static Concept CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Concept entity = new rt.srz.model.srz.Concept();


            entity.Code        = "123";
            entity.Name        = "Test Test ";
            entity.Description = "Test Test ";
            entity.ShortName   = "Test Test ";
            entity.RelatedCode = "Test Test ";
            entity.RelatedOid  = "Test Test ";
            entity.RelatedType = "Test Test ";
            entity.DateFrom    = System.DateTime.Now;
            entity.DateTo      = System.DateTime.Now;
            entity.Relevance   = 53;

            using (rt.srz.business.manager.IOidManager oidManager = ObjectFactory.GetInstance <IOidManager>())
            {
                entity.Oid = null;
            }

            return(entity);
        }
예제 #5
0
        public void Update()
        {
            try
            {
                rt.srz.model.srz.Concept entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Concept entityA = GetFirstConcept();

                entityA.Code = "123";

                manager.Update(entityA);

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

                Assert.AreEqual(entityA.Code, entityB.Code);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }