Пример #1
0
        public void TestGetLdapPathParts(string ldapPath, string ldapRoot, string expectedDN, string expectedOU, string expectedCN)
        {
            string dn = "";
            string ou = "";
            string cn = "";

            HelperLdapGet.GetLdapPathParts(ldapPath, ldapRoot, ref cn, ref ou, ref dn);

            Assert.AreEqual(expectedDN, dn, "DN is not as expected. Expected: " + expectedDN + "  Actual: " + dn);
            Assert.AreEqual(expectedOU, ou, "OU is not as expected. Expected: " + expectedOU + "  Actual: " + ou);
            Assert.AreEqual(expectedCN, cn, "CN is not as expected. Expected: " + expectedCN + "  Actual: " + cn);
        }
Пример #2
0
        public void TestADQuery(string domain, string usr, string pwd, string objectClass, string ouLimit, int pageSize, int pageSizeTestLimit)
        {
            // Get the DataTable extracted
            DataTable oDt = null;

            if (objectClass.ToLower() == "user")
            {
                oDt = Ad2DataTable.ExtractDataTable_Users(domain, usr, pwd, ouLimit, pageSize);
            }
            else if (objectClass.ToLower() == "organizationalunit")
            {
                oDt = Ad2DataTable.ExtractDataTable_Units(domain, usr, pwd, ouLimit, pageSize);
            }
            else if (objectClass.ToLower() == "group")
            {
                oDt = Ad2DataTable.ExtractDataTable_Groups(domain, usr, pwd, ouLimit, pageSize);
            }
            Assert.NotNull(oDt, objectClass + " DataTable is null. These tests may be disabled or there is a possible connectivity issue, check your test settings in BasicTests.cs.");

            // Get a simple query count
            Int32 queryCount = HelperLdapGet.GetObjectSetCount(domain, ouLimit, usr, pwd, objectClass, "", pageSizeTestLimit);

            Assert.AreEqual(oDt.Rows.Count, queryCount, objectClass + " DataTable count does not match the actual query count. You may need to increase your pageSize.");
        }
Пример #3
0
        public void TestGetObjectNameQuery(string objectClass, string cn, string expectedQuery)
        {
            string query = HelperLdapGet.GetObjectNameQuery(objectClass, cn);

            Assert.AreEqual(expectedQuery, query, "Query is not as expected. Expected: " + expectedQuery + "  Actual: " + query);
        }
Пример #4
0
        public void TestGetLdapPath(string domain, string ou, string cn, string expectedLDapPath)
        {
            string ldapPath = HelperLdapGet.GetLdapPath(domain, ou, cn);

            Assert.AreEqual(expectedLDapPath, ldapPath, "Path is not as expected. Expected: " + expectedLDapPath + "  Actual: " + ldapPath);
        }