예제 #1
0
        public void RetrieveRanges_NoStartSpecified_GetsRanges()
        {
            //prepare
            string attribute = "member";
            string dn        = "CN=RangeTest,CN=Roles,CN=Employees,DC=Northwind,DC=local";

            //act
            var group = _context.RetrieveRanges <string>(dn, attribute);

            //assert
            group.Should().Have.Count.GreaterThan(2000);
        }
 /// <summary>
 /// Executes <see cref="DirectoryContext.RetrieveRanges{TValue}"/> within a <see cref="Task"/>.
 /// </summary>
 /// <typeparam name="TValue">The type of the attribute.  Must be <see cref="string"/> or <see cref="Array"/> of <see cref="byte"/>.</typeparam>
 /// <param name="context">The context.</param>
 /// <param name="distinguishedName">The distinguished name of the entry.</param>
 /// <param name="attributeName">The attribute to load.</param>
 /// <param name="start">The starting point for the range. Defaults to 0.</param>
 /// <exception cref="ArgumentNullException">
 /// Thrown if <paramref name="distinguishedName"/> or <paramref name="attributeName"/> is null, empty or white space.
 /// </exception>
 /// <returns></returns>
 public static Task <IList <TValue> > RetrieveRangesAsync <TValue>(this IDirectoryContext context, string distinguishedName,
                                                                   string attributeName, int start = 0)
 {
     return(Task.Factory.StartNew(() => context.RetrieveRanges <TValue>(distinguishedName, attributeName, start)));
 }