示例#1
0
        public void IllegalRemoveSecretaryTest3()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");
            var testUserB = this.NewObject <PC.SCUser>("测试用户B");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUser(testUserB, testOrgB);

            SetContainerMemberAndPermissions(testOrgB, mainRole, new string[] { "UpdateChildren" });

            Facade.AddSecretaryToUser(testUserA, testUserB);

            this.SetCurrentPrincipal(this.GetUserByCodeName("wanglch"));

            FacadeWithAcl.RemoveSecretaryFromUser(testUserA, testUserB);

            Assert.Fail("不应执行到此");
        }
示例#2
0
        public void LegalRemoveSecretaryTest()
        {
            InitAdmins();

            var mainRole  = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch"));
            var mainOrg   = this.GetOrganizationByCodeName("costEngineer");
            var testOrgA  = NewObject <PC.SCOrganization>("测试组织A");
            var testOrgB  = NewObject <PC.SCOrganization>("测试组织B");
            var testUserA = this.NewObject <PC.SCUser>("测试用户A");
            var testUserB = this.NewObject <PC.SCUser>("测试用户B");

            Facade.AddOrganization(testOrgA, mainOrg);
            Facade.AddOrganization(testOrgB, mainOrg);
            Facade.AddUser(testUserA, testOrgA);
            Facade.AddUser(testUserB, testOrgB);

            SetContainerMemberAndPermissions(testOrgA, mainRole, new string[] { "UpdateChildren" });
            SetContainerMemberAndPermissions(testOrgB, mainRole, new string[] { "UpdateChildren" });

            Facade.AddSecretaryToUser(testUserA, testUserB);

            this.SetCurrentPrincipal(this.GetUserByCodeName("wanglch"));

            FacadeWithAcl.RemoveSecretaryFromUser(testUserA, testUserB);

            var actual = PC.Adapters.SCMemberRelationAdapter.Instance.Load(testUserB.ID, testUserA.ID);

            Assert.IsNotNull(actual);

            Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal);
        }