Пример #1
0
        public static Ot CreateNew(int depth = 0)
        {
            rt.atl.model.atl.Ot entity = new rt.atl.model.atl.Ot();


            entity.Caption = "Test Test Test Test";
            entity.W       = 6;

            return(entity);
        }
Пример #2
0
        public void Create()
        {
            try
            {
                rt.atl.model.atl.Ot entity = CreateNew();

                object result = manager.Save(entity);

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

                rt.atl.model.atl.Ot entityB = manager.GetById(entityA.Id);

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

                rt.atl.model.atl.Ot entity = GetFirstOt();

                manager.Delete(entity);

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

                rt.atl.model.atl.Ot entityA = GetFirstOt();

                entityA.Caption = "Tes";

                manager.Update(entityA);

                rt.atl.model.atl.Ot entityB = manager.GetById(entityA.Id);

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