public void Create()
        {
            try
            {
                rt.core.model.core.PermissionRole entity = CreateNew();

                object result = manager.Save(entity);

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

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

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

                rt.core.model.core.PermissionRole entity = GetFirstPermissionRole();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
        public static PermissionRole CreateNew(int depth = 0)
        {
            rt.core.model.core.PermissionRole entity = new rt.core.model.core.PermissionRole();

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

            entity.FakeField = 88;

            using (rt.core.business.manager.IPermissionManager permissionManager = ObjectFactory.GetInstance <IPermissionManager>())
            {
                entity.Permission = null;
            }

            using (rt.core.business.manager.IRoleManager roleManager = ObjectFactory.GetInstance <IRoleManager>())
            {
                entity.Role = null;
            }

            return(entity);
        }
        public void Update()
        {
            try
            {
                rt.core.model.core.PermissionRole entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.core.model.core.PermissionRole entityA = GetFirstPermissionRole();

                entityA.FakeField = 86;

                manager.Update(entityA);

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

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