Пример #1
0
        public void Create()
        {
            try
            {
                rt.core.model.core.UserGroup entity = CreateNew();

                object result = manager.Save(entity);

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

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

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

                rt.core.model.core.UserGroup entity = GetFirstUserGroup();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Пример #4
0
        public static UserGroup CreateNew(int depth = 0)
        {
            rt.core.model.core.UserGroup entity = new rt.core.model.core.UserGroup();

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

            entity.FakeField = 7;

            using (rt.core.business.manager.IGroupManager groupManager = ObjectFactory.GetInstance <IGroupManager>())
            {
                entity.Group = null;
            }

            using (rt.core.business.manager.IUserManager userManager = ObjectFactory.GetInstance <IUserManager>())
            {
                entity.User = null;
            }

            return(entity);
        }
Пример #5
0
        public void Update()
        {
            try
            {
                rt.core.model.core.UserGroup entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.core.model.core.UserGroup entityA = GetFirstUserGroup();

                entityA.FakeField = 4;

                manager.Update(entityA);

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

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