public void RoleInheritRelationService_AddRelation_Test()
        {
            var roleId = 3;
            var inheritRoleId = 4;

            //初始化
            var unit = EntityUnitOfWorkFactory.CreateUnitOfWork();
            var roleInheritRelationService = new RoleInheritRelationService(unit);
            var roleRepository = new RoleRepository(unit);

            var role = roleRepository.Get(roleId);
            var inheritRole = roleRepository.Get(inheritRoleId);

            var inheritRoles = roleInheritRelationService.GetInheritRolesOfRole(role, false);
            Assert.IsFalse(inheritRoles.Contains(inheritRole));

            //启动事务进行测试,并不提交
            using (var ts = new TransactionScope())
            {
                roleInheritRelationService.AddRelation(role, inheritRole);
                unit.SaveChanges();

                inheritRoles = roleInheritRelationService.GetInheritRolesOfRole(role, false);
                Assert.IsTrue(inheritRoles.Contains(inheritRole));
            }
        }
        public void RoleInheritRelationService_AddRelation_InheritSelf_Test()
        {
            var roleId = 3;

            //初始化
            var unit = EntityUnitOfWorkFactory.CreateUnitOfWork();
            var roleInheritRelationService = new RoleInheritRelationService(unit);
            var roleRepository = new RoleRepository(unit);

            var role = roleRepository.Get(roleId);

            //启动事务进行测试,并不提交
            using (var ts = new TransactionScope())
            {
                roleInheritRelationService.AddRelation(role, role);
            }
        }