Exemple #1
0
        public SchemaObjectCollection ToSchemaObjects()
        {
            SchemaObjectCollection result = new SchemaObjectCollection();

            this.ForEach(u => result.Add(u));

            return(result);
        }
        public void ClearOrganizationWithChildrenTest()
        {
            var testOrg = NewObject <PC.SCOrganization>();

            Facade.AddOrganization(testOrg, PC.SCOrganization.GetRoot());

            var testSubOrg = NewObject <PC.SCOrganization>();

            Facade.AddOrganization(testSubOrg, testOrg);

            var testChildOrg = NewObject <PC.SCOrganization>();

            Facade.AddOrganization(testChildOrg, testSubOrg);

            var testChildUser = NewObject <PC.SCUser>();

            Facade.AddUser(testChildUser, testSubOrg);

            var testChildGroup = NewObject <PC.SCGroup>();

            Facade.AddGroup(testChildGroup, testSubOrg);

            PC.SchemaObjectCollection collection = new PC.SchemaObjectCollection();
            collection.Add(testSubOrg);

            Facade.DeleteObjectsRecursively(collection, testOrg);

            var actualSubOrg     = LoadObject <PC.SCOrganization>(testSubOrg.ID);
            var actualChildOrg   = LoadObject <PC.SCOrganization>(testChildOrg.ID);
            var actualChildUser  = LoadObject <PC.SCUser>(testChildUser.ID);
            var actualChildGroup = LoadObject <PC.SCGroup>(testChildGroup.ID);

            Assert.AreNotEqual(SchemaObjectStatus.Normal, actualSubOrg.Status);

            Assert.AreEqual(0, actualSubOrg.CurrentChildren.Count);

            Assert.AreEqual(0, actualChildGroup.CurrentParentRelations.Count);
            Assert.AreEqual(0, actualChildOrg.CurrentParentRelations.Count);
            Assert.AreEqual(0, actualChildUser.CurrentParentRelations.Count);
        }