Example #1
0
        public void TestSearchAllNodes()
        {
            //////////////////////////////////////////////////////////
            // ATTENTION, THIS TEST WILL FAIL IF IN THE DEFAULT LOCALHOST LDAP ISN'T PRESENT:
            // Matteo : objectClass -> person
            // Alessandro : objectClass -> person
            // Clock : objectClass -> device
            //////////////////////////////////////////////////////////
            TestAdminConnect();

            var userAttributeToReturnBySearch = new List <string>
            {
                "description"
            };

            IList <ILdapUser> returnUsers;

            var result = _ldapManagerObj.SearchAllNodes(null, out returnUsers);

            Assert.IsTrue(result);
            Assert.AreEqual(returnUsers.Count, 4);
            Assert.AreEqual(returnUsers[1].GetUserCn(), ReadOnlyUserCn);
            Assert.IsTrue(returnUsers[1].GetUserAttributes().Count == 0);

            result = _ldapManagerObj.SearchAllNodes(userAttributeToReturnBySearch, out returnUsers);

            Assert.IsTrue(result);
            Assert.AreEqual(returnUsers.Count, 4);
            Assert.AreEqual(returnUsers[1].GetUserCn(), ReadOnlyUserCn);
            Assert.IsTrue(returnUsers[1].GetUserAttributes().Count == 1);
        }
Example #2
0
        public bool TestSearchAllNodes()
        {
            if (!TestAdminConnect())
            {
                return(false);
            }

            IList <ILdapUser> returnUsers;

            bool result = _ldapManagerObj.SearchAllNodes(null, out returnUsers);

            if (result && _userRepository.ExpectedSearchAllNodesResultNumber == 0)
            {
                return(true);
            }

            return(result && returnUsers.Count.Equals(_userRepository.ExpectedSearchAllNodesResultNumber));
        }