Exemple #1
0
        public void Create()
        {
            try
            {
                rt.srz.model.srz.Oid entity = CreateNew();

                object result = manager.Save(entity);

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

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

                Assert.AreEqual(entityA, entityB);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Exemple #3
0
        public static Oid CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Oid entity = new rt.srz.model.srz.Oid();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = "Test Test Test Test Test Test Test Test Test T";

            entity.FullName  = "Test Test ";
            entity.ShortName = "Test Test ";
            entity.LatinName = "Test Test ";

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

            return(entity);
        }
Exemple #4
0
        public void Delete()
        {
            try
            {
                rt.srz.model.srz.Oid entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Oid entity = GetFirstOid();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Exemple #5
0
        public void Update()
        {
            try
            {
                rt.srz.model.srz.Oid entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Oid entityA = GetFirstOid();

                entityA.FullName = "Test Test ";

                manager.Update(entityA);

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

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