public void TestSchema() { using (ActiveDirectorySchema schema = ActiveDirectorySchema.GetSchema(ActiveDirectoryContext)) { Assert.True(schema.FindAllClasses().Contains(ActiveDirectorySchemaClass.FindByName(ActiveDirectoryContext, "user"))); Assert.True(schema.FindAllClasses().Contains(ActiveDirectorySchemaClass.FindByName(ActiveDirectoryContext, "samDomainBase"))); Assert.NotNull(schema.FindAllDefunctClasses()); Assert.NotNull(schema.FindAllDefunctProperties()); Assert.True(schema.FindAllProperties(PropertyTypes.Indexed).Contains(ActiveDirectorySchemaProperty.FindByName(ActiveDirectoryContext, "ou"))); Assert.True(schema.FindAllProperties().Contains(ActiveDirectorySchemaProperty.FindByName(ActiveDirectoryContext, "cn"))); Assert.Equal("person", schema.FindClass("person").Name); Assert.Equal("cn", schema.FindProperty("cn").Name); using (DirectoryEntry de = schema.GetDirectoryEntry()) { Assert.True("CN=Schema".Equals(de.Name, StringComparison.OrdinalIgnoreCase)); } } }