public static ActiveDirectoryUser[] GetTestUsers()
 {
     List<ActiveDirectoryUser> testUsers = new List<ActiveDirectoryUser>();
     ActiveDirectoryUser u = new ActiveDirectoryUser();
     u.AddProperty("cn", "tu001");
     u.AddProperty("mail", "*****@*****.**");
     u.AddProperty("sn", "Test");
     u.AddProperty("givenName", "User,MD");
     testUsers.Add(u);
     return testUsers.ToArray();
 }
        private ActiveDirectoryUser[] ParseFull(SearchResultCollection results)
        {
            List<ActiveDirectoryUser> userList = new List<ActiveDirectoryUser>();

            foreach (SearchResult result in results)
            {
                ActiveDirectoryUser u = new ActiveDirectoryUser();
                userList.Add(u);

                DirectoryEntry innerEntry = new DirectoryEntry(result.Path,
                    CriticalResults.Properties.Settings.Default.LDAPUsername,
                    CriticalResults.Properties.Settings.Default.LDAPPassword);
                int proxyAddressCount = 0;
                foreach (string name in innerEntry.Properties.PropertyNames)
                {
                    //Added to retrieve proxy email address from active directory to facilitate partners search
                    //Check if value is array of objects instead of single object
                    if (innerEntry.Properties[name].Value.GetType() == typeof(object[]) && name == "proxyAddresses")
                    {
                        //Get array of values
                        object[] value = (object[])innerEntry.Properties[name].Value;
                        foreach (object obj in value)
                        {
                            //if value is an email address add it to the user object with name of 'mail_x'
                            if (((string)obj).ToLower().Contains("smtp"))
                            {
                                proxyAddressCount++;
                                string property_value = obj as string;
                                string property_name = "mail_" + proxyAddressCount.ToString();
                                u.AddProperty(property_name, property_value);
                            }
                        }
                    }
                    else
                    {
                        string value = innerEntry.Properties[name].Value.ToString();
                        u.AddProperty(name, value);
                    }
                }
                u.AddProperty("Proxy_Address_Count", proxyAddressCount.ToString());
            }
            return userList.ToArray();
        }