public async Task Delete_OfExistingEntry_ShouldWork()
        {
            var existingEntry = await LdapOps.AddEntryAsync();

            await TestHelper.WithAuthenticatedLdapConnectionAsync(async ldapConnection => { await ldapConnection.DeleteAsync(existingEntry.Dn); });

            var retrievedEntry = await LdapOps.GetEntryAsync(existingEntry.Dn);

            Assert.Null(retrievedEntry);
        }
Пример #2
0
        public async Task AddEntry_NotExisting_ShouldWork()
        {
            var ldapEntry = LdapEntryHelper.NewLdapEntry();

            await TestHelper.WithAuthenticatedLdapConnectionAsync(async ldapConnection => { await ldapConnection.AddAsync(ldapEntry); });

            var readEntry = await LdapOps.GetEntryAsync(ldapEntry.Dn);

            ldapEntry.AssertSameAs(readEntry);
        }
Пример #3
0
        public async Task ModifyAttributeValue_OfExistingEntry_ShouldWork()
        {
            var existingEntry = await LdapOps.AddEntryAsync();

            var          value    = Guid.NewGuid().ToString();
            const string attrName = "givenName";

            await TestHelper.WithAuthenticatedLdapConnectionAsync(async ldapConnection =>
            {
                var modifiedAttribute = new LdapAttribute(attrName, value);
                var modification      = new LdapModification(LdapModification.Replace, modifiedAttribute);
                await ldapConnection.ModifyAsync(existingEntry.Dn, modification);
            });

            var modifiedEntry = await LdapOps.GetEntryAsync(existingEntry.Dn);

            Assert.Equal(value, modifiedEntry.GetAttribute(attrName).StringValue);
        }
Пример #4
0
        public async Task Rename_ExistingEntry_ShouldWork()
        {
            var entry = await LdapOps.AddEntryAsync();

            var newCn = Guid.NewGuid().ToString();

            await TestHelper.WithAuthenticatedLdapConnectionAsync(async ldapConnection =>
            {
                await ldapConnection.RenameAsync(entry.Dn, "cn=" + newCn, true);
            });

            Assert.Null(await LdapOps.GetEntryAsync(entry.Dn));
            var renamedEntry = await LdapOps.GetEntryAsync(TestHelper.BuildDn(newCn));

            Assert.NotNull(renamedEntry);
            entry.GetAttributeSet().AssertSameAs(renamedEntry.GetAttributeSet(), new List <string> {
                "cn"
            });
        }