Exemple #1
0
        public void Contains_ReturnsMockResults()
        {
            var m = new Dictionary <string, Core.Proxies.AttributeValueList>()
            {
                { "a key", new Core.Proxies.AttributeValueList(new List <object>()) }
            };
            var p = new EntryAttributeDictionary(m);

            Assert.True(p.ContainsKey("a key"));
            Assert.False(p.ContainsKey("another key"));
        }
Exemple #2
0
        protected internal AttributeValueList GetAttributeRawValue <T>(
            string ldapAttrName,
            PropertyInfo prop,
            EntryAttributeDictionary entryProps,
            LdapFieldAttribute attr)
        {
            if (!(entryProps.ContainsKey(ldapAttrName) || attr.Optional))
            {
                throw new ArgumentException(
                          $"LDAP attribute '{attr.Name}' for property '{prop.Name}' on type '{typeof(T).FullName}'"
                          + " is not marked as optional, but was not found in the store.");
            }

            if (entryProps.TryGetValue(ldapAttrName, out var val))
            {
                return(val);
            }

            return(null);
        }