Beispiel #1
0
        public void TestCreateUser()
        {
            var tempUser     = new LdapUser(WriteUserDn, WriteUserCn, "test", null);
            var existingUser = new LdapUser(ReadOnlyUserDn, ReadOnlyUserCn, "test",
                                            new Dictionary <string, List <string> > {
                { "userPassword", new List <string> {
                      ReadOnlyUserPwd
                  } }
            });

            //Init the DLL and connect the admin
            TestAdminConnect();

            //Create existing user
            var result = _ldapManagerObj.CreateUser(existingUser);

            //Assert the correct operations
            Assert.IsFalse(result);
            Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1), "LDAP CREATE USER ERROR: ");

            //Create user
            result = _ldapManagerObj.CreateUser(tempUser);

            //Assert the correct operations
            Assert.IsTrue(result);
            Assert.AreEqual(_ldapManagerObj.GetLdapMessage().Split('-')[1].Substring(1),
                            "LDAP USER MANIPULATION SUCCESS: ");

            result = _ldapManagerObj.DeleteUser(tempUser);

            Assert.IsTrue(result);
        }
Beispiel #2
0
        public void testCreateUser()
        {
            LdapUser testLdapUser = setupTestUser();

            //Init the DLL and connect the admin
            testAdminConnect();

            //Create user
            bool result = LdapManagerObj.CreateUser(testLdapUser);

            //Assert the correct operations
            Assert.IsTrue(result);
            Assert.AreEqual(LdapManagerObj.GetLdapMessage(), "LDAP USER MANIPULATION SUCCESS: " + "Create User Operation Success");

            result = LdapManagerObj.DeleteUser(testLdapUser);

            Assert.IsTrue(result);
        }
Beispiel #3
0
        public bool TestCreateUser()
        {
            if (!TestAdminConnect())
            {
                return(false);
            }

            //Create user
            bool result = _ldapManagerObj.CreateUser(_userRepository.TestUser);

            //Assert the correct operations
            if (!result &&
                !_ldapManagerObj.GetLdapMessage()
                .Contains("LDAP USER MANIPULATION SUCCESS: " + "Create User Operation Success")
                )
            {
                return(false);
            }


            result = _ldapManagerObj.DeleteUser(_userRepository.TestUser);

            return(result);
        }