Exemple #1
0
        public static Role CreateNew(int depth = 0)
        {
            rt.core.model.core.Role entity = new rt.core.model.core.Role();

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

            entity.Name = "Test Test Test Test Test Test Test Test Test Tes";
            entity.Code = 90;

            return(entity);
        }
Exemple #2
0
        public void Create()
        {
            try
            {
                rt.core.model.core.Role entity = CreateNew();

                object result = manager.Save(entity);

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

                rt.core.model.core.Role entityB = manager.GetById(entityA.Id);

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

                rt.core.model.core.Role entity = GetFirstRole();

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

                rt.core.model.core.Role entityA = GetFirstRole();

                entityA.Name = "Test Test Test Test Test Test Test Test ";

                manager.Update(entityA);

                rt.core.model.core.Role entityB = manager.GetById(entityA.Id);

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