public void TestOfAdminDeleteRole() { base.InitAdmins(); var mainApp = this.CreateDefaultApp(); var testRole = NewObject <SCRole>("测试角色"); this.CreateRole(mainApp, testRole); FacadeWithAcl.DeleteRole(testRole); var actual = (PC.SCRole)PC.Adapters.SchemaObjectAdapter.Instance.Load(testRole.ID); Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal); }
public void TestOfIllegalDeleteRole() { base.InitAdmins(); var mainApp = this.CreateDefaultApp(); var testRole = NewObject <SCRole>("测试角色"); this.CreateRole(mainApp, testRole); this.SetCurrentPrincipal(this.GetUserByCodeName("chenke")); FacadeWithAcl.DeleteRole(testRole); Assert.Fail("不应该执行到此"); }
public void TestOfDeleteRole() { base.InitAdmins(); var mainApp = this.CreateDefaultApp(); var mainRole = this.CreateDefaultRoleWithMembers(this.GetSCUsersByCodeNames("wanglch")); this.SetContainerMemberAndPermissions(mainApp, mainRole, new string[] { "DeleteRoles" }); var testRole = NewObject <SCRole>("测试角色"); this.CreateRole(mainApp, testRole); this.SetCurrentPrincipal(this.GetUserByCodeName("wanglch")); FacadeWithAcl.DeleteRole(testRole); var actual = (PC.SCRole)PC.Adapters.SchemaObjectAdapter.Instance.Load(testRole.ID); Assert.AreNotEqual(actual.Status, SchemaObjectStatus.Normal); }