Пример #1
0
        private void FindFirstEnumerateAll(string domainID)
        {
            string context;

            Member[] memberList;
            int      total;

            bool moreEntries =
                DomainProvider.FindFirstDomainMembers(
                    domainID,
                    MemberCount + 1,
                    out context,
                    out memberList,
                    out total);

            if (moreEntries)
            {
                throw new ApplicationException("More entries returned.");
            }
            if (memberList == null)
            {
                throw new ApplicationException("No member list returned.");
            }
            if (memberList.Length != total)
            {
                throw new ApplicationException("Not all entries returned in list.");
            }
            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }

            CheckMemberOrder(memberList);
            DomainProvider.FindCloseDomainMembers(domainID, context);
        }
Пример #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);
        }
Пример #3
0
        private void FindFirstEnumerateByCount(string domainID, int count)
        {
            string context;

            Member[] memberList;
            int      total;

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

            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }

            if (count <= total)
            {
                if (moreEntries == false)
                {
                    throw new ApplicationException("No more entries.");
                }
            }
            else
            {
                if (moreEntries == true)
                {
                    throw new ApplicationException("More entries returned.");
                }
            }

            if (count > 0)
            {
                if (memberList == null)
                {
                    throw new ApplicationException("No member list returned.");
                }
                if (count < total)
                {
                    if (memberList.Length != count)
                    {
                        throw new ApplicationException("Member list is not correct.");
                    }
                }
                else
                {
                    if (memberList.Length != total)
                    {
                        throw new ApplicationException("Member list is not correct.");
                    }
                }

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

            DomainProvider.FindCloseDomainMembers(domainID, context);
        }