예제 #1
0
        public void TestCustomSearch()
        {
            int            count    = 0;
            string         userName = null;
            IList <ADUser> result   = null;

            try
            {
                result   = DSFactory.SearchUser(UserSearchProperty.SamAccountName, "Administrator");
                count    = result.Count;
                userName = result[0].SamAccountName;
            }
            finally
            {
                if (null != result)
                {
                    foreach (var user in result)
                    {
                        user.Dispose();
                    }
                }
            }
            Assert.AreEqual(1, count);
            Assert.AreEqual("Administrator", userName, true);
        }
예제 #2
0
        public void TestGetAccountNames1()
        {
            var an    = new AccountNamesFactory();
            var names = an.GetNames("Unique", "Name", "example.com", "199700000000");
            var list  = DSFactory.SearchUser(UserSearchProperty.SamAccountName, names.SamAccountName);

            Assert.AreEqual(0, list.Count);
            list = DSFactory.SearchUser(UserSearchProperty.UserPrincipalName, names.UserPrincipalName);
            Assert.AreEqual(0, list.Count);
            list = DSFactory.SearchUser(UserSearchProperty.CommonName, names.CommonName);
            Assert.AreEqual(0, list.Count);
        }