Beispiel #1
0
        private void FindSeekEnumerateAll(string domainID)
        {
            string context;

            Member[] memberList;
            int      total;

            bool moreEntries =
                DomainProvider.FindFirstDomainMembers(
                    domainID,
                    0,
                    out context,
                    out memberList,
                    out total);

            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }
            if (moreEntries == false)
            {
                throw new ApplicationException("No entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            moreEntries =
                DomainProvider.FindSeekDomainMembers(
                    domainID,
                    ref context,
                    0,
                    MemberCount + 1,
                    out memberList);

            if (moreEntries == true)
            {
                throw new ApplicationException("More entries returned.");
            }
            if (memberList == null)
            {
                throw new ApplicationException("No member list returned.");
            }
            if (memberList.Length != total)
            {
                throw new ApplicationException("Member list is incorrect.");
            }

            CheckMemberOrder(memberList);
            DomainProvider.FindCloseDomainMembers(domainID, context);
        }
Beispiel #2
0
        private void FindSeekEnumerateByCount(string domainID, int count)
        {
            string context;

            Member[] memberList;
            int      total;
            int      i;

            bool moreEntries =
                DomainProvider.FindFirstDomainMembers(
                    domainID,
                    0,
                    out context,
                    out memberList,
                    out total);

            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }
            if (moreEntries == false)
            {
                throw new ApplicationException("No entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            for (i = -1; i <= total; ++i)
            {
                moreEntries =
                    DomainProvider.FindSeekDomainMembers(
                        domainID,
                        ref context,
                        i,
                        count,
                        out memberList);

                if (count > 0)
                {
                    if (i < 0)
                    {
                        if (moreEntries == true)
                        {
                            throw new ApplicationException("More entries returned.");
                        }
                        if (memberList != null)
                        {
                            throw new ApplicationException("Member list returned.");
                        }
                    }
                    else if (i < total)
                    {
                        if (memberList == null)
                        {
                            throw new ApplicationException("No member list returned.");
                        }

                        if ((total - i) >= count)
                        {
                            if (moreEntries == false)
                            {
                                throw new ApplicationException("No more entries.");
                            }
                            if (memberList.Length != count)
                            {
                                throw new ApplicationException("Member list is incorrect.");
                            }
                        }
                        else
                        {
                            if (moreEntries == true)
                            {
                                throw new ApplicationException("More entries returned.");
                            }
                            if (memberList.Length != (total - i))
                            {
                                throw new ApplicationException("Member list is incorrect.");
                            }
                        }
                    }
                    else
                    {
                        if (moreEntries == true)
                        {
                            throw new ApplicationException("More entries returned.");
                        }
                        if (memberList != null)
                        {
                            throw new ApplicationException("Member list returned.");
                        }
                    }
                }
                else
                {
                    if (i < 0)
                    {
                        if (moreEntries == true)
                        {
                            throw new ApplicationException("More entries returned.");
                        }
                    }
                    else if (i < total)
                    {
                        if (moreEntries == false)
                        {
                            throw new ApplicationException("No more entries.");
                        }
                    }
                    else
                    {
                        if (moreEntries == true)
                        {
                            throw new ApplicationException("More entries returned.");
                        }
                    }

                    if (memberList != null)
                    {
                        throw new ApplicationException("Member list returned.");
                    }
                }
            }

            DomainProvider.FindCloseDomainMembers(domainID, context);
        }