예제 #1
0
        private void Build()
        {
            CompanyTenant = _testHelper.CreateTenant("Worldwide Corporation", Guid.NewGuid().ToString());

            HeadPosition   = _testHelper.CreatePosition("Head");
            MemberPosition = _testHelper.CreatePosition("Member");

            DivisionGroupType = _testHelper.CreateGroupType("Division");
            DivisionHead      = _testHelper.CreateGroupTypePosition(DivisionGroupType, HeadPosition);
            DivisionMember    = _testHelper.CreateGroupTypePosition(DivisionGroupType, MemberPosition);
            AustrianDivsion   = CreateGroup("Austria", null, CompanyTenant, DivisionGroupType);
            GermanDivision    = CreateGroup("Germany", null, CompanyTenant, DivisionGroupType);

            DepartmentGroupType = _testHelper.CreateGroupType("Department");
            DepartmentHead      = _testHelper.CreateGroupTypePosition(DepartmentGroupType, HeadPosition);
            DepartmentMember    = _testHelper.CreateGroupTypePosition(DepartmentGroupType, MemberPosition);
            AustrianHumanResourcesDepartment = CreateGroup("Human Resources (Austria)", AustrianDivsion, CompanyTenant, DepartmentGroupType);
            AustrianFinanceDepartment        = CreateGroup("Human Resources (Austria)", AustrianDivsion, CompanyTenant, DepartmentGroupType);
            AustrianProjectsDepartment       = CreateGroup("Projects (Austria)", AustrianDivsion, CompanyTenant, DepartmentGroupType);
            GermanHumanResourcesDepartment   = CreateGroup("Human Resources (Germany)", GermanDivision, CompanyTenant, DepartmentGroupType);

            TeamGroupType          = _testHelper.CreateGroupType("Team");
            TeamHead               = _testHelper.CreateGroupTypePosition(TeamGroupType, HeadPosition);
            TeamMember             = _testHelper.CreateGroupTypePosition(TeamGroupType, MemberPosition);
            AustrianCarTeam        = CreateGroup("Car Developers", AustrianProjectsDepartment, CompanyTenant, TeamGroupType);
            AustrianPlaneTeam      = CreateGroup("Plane Developers", AustrianProjectsDepartment, CompanyTenant, TeamGroupType);
            AustrianAccountingTeam = CreateGroup("Accounts", AustrianFinanceDepartment, CompanyTenant, TeamGroupType);

            OwningGroup = CreateGroup("Users", null, CompanyTenant, null);

            CarTeamMember = CreateUser("CarTeamMember", OwningGroup, CompanyTenant);
            _testHelper.CreateRole(CarTeamMember, AustrianCarTeam, MemberPosition);
        }
예제 #2
0
        public void DeleteGroup_WithRole()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                Tenant   tenant    = testHelper.CreateTenant("TestTenant", "UID: testTenant");
                Group    userGroup = testHelper.CreateGroup("UserGroup", Guid.NewGuid().ToString(), null, tenant);
                Group    roleGroup = testHelper.CreateGroup("RoleGroup", Guid.NewGuid().ToString(), null, tenant);
                User     user      = testHelper.CreateUser("user", "Firstname", "Lastname", "Title", userGroup, tenant);
                Position position  = testHelper.CreatePosition("Position");
                Role     role      = testHelper.CreateRole(user, roleGroup, position);

                roleGroup.Delete();

                Assert.That(role.State, Is.EqualTo(StateType.Invalid));
            }
        }