public void Test_03_RetrieveLdapAddress()
        {
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
            Assert.IsNotNull(da, "The Directory Analyzer is null therefore will fail!");
            Assert.IsTrue(da.IsLdapAvailable, "The LDAP Engine is not available");
            Assert.IsTrue(da.IsLdapEnabled, "The LDAP Engine is not enabled");
            
            IAddress adr = da.GetAddressInformation("CN=DevBuild,OU=Engineering,O=Workshare,C=ZA");
            Assert.IsTrue((adr.AddressType == AddressType.Smtp), "The Address type is not the same");
            Assert.AreEqual(adr.DisplayName, "DevBuild", "The display names are not the same");

            adr = da.GetAddressInformation("CN=Internal2/OU=Engineering/O=Workshare/C=ZA");
            Assert.IsTrue((adr.AddressType == AddressType.Smtp), "The Address type is not the same");
            Assert.AreEqual(adr.DisplayName, "Internal2", "The display names are not the same");

        }
        public void Test_03_RetrieveLdapAddress()
        {
            Test_Helper.SetupWsQADomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
        
            Assert.IsNotNull(da, "The Directory Analyzer is null therefore will fail!");
            Assert.IsTrue(da.IsLdapAvailable, "The LDAP Engine is not available");
            Assert.IsTrue(da.IsLdapEnabled, "The LDAP Engine is not enabled");

            IAddress adr = da.GetAddressInformation("CN=qa1,DC=wsqa,DC=net");
            Assert.IsTrue((adr.AddressType == AddressType.Smtp), "The Address type is not the same");
            Assert.AreEqual(adr.DisplayName, "qa1", "The display names are not the same");
        }
 public void Test_02_RetrieveSmtpEmailAddress()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     Assert.IsNotNull(da, "The Directory Analyzer is null therefore will fail!");
     Assert.IsTrue(da.IsLdapAvailable, "The LDAP Engine is not available");
     Assert.IsTrue(da.IsLdapEnabled, "The LDAP Engine is not enabled");
 
     IAddress adr = da.GetAddressInformation("*****@*****.**");
     Assert.IsTrue((adr.AddressType == AddressType.Smtp), "The Address type is not the same");
     Assert.AreEqual(adr.DisplayName, "DevBuild", "The display names are not the same");
     Assert.AreEqual(adr.Email, "*****@*****.**", "The email address are not the same");
     Assert.AreEqual(adr.LdapPath, "CN=DevBuild,OU=Engineering,O=Workshare,C=ZA", "The Ldap address are different");
 }
 public void Test_02_RetrieveSmtpEmailAddress()
 {
     Test_Helper.SetupWsQADomain();
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     
     Assert.IsNotNull(da, "The Directory Analyzer is null therefore will fail!");
     Assert.IsTrue(da.IsLdapAvailable, "The LDAP Engine is not available");
     Assert.IsTrue(da.IsLdapEnabled, "The LDAP Engine is not enabled");
     
     IAddress adr = da.GetAddressInformation("*****@*****.**");
     Assert.IsTrue((adr.AddressType == AddressType.Smtp), "The Address type is not the same");
     Assert.AreEqual(adr.DisplayName, "qa1", "The display names are not the same");
     Assert.AreEqual(adr.Email, "*****@*****.**", "The email address are not the same");
     Assert.AreEqual(adr.LdapPath, "CN=qa1,OU=Users,OU=QA Accounts,OU=LN QA,OU=QA Control,DC=wsqa,DC=net", "The Ldap address are different");
 }
        public void Test_11_X500ADGroupAddress()
        {
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
            IAddress i1 = da.GetAddressInformation("cn=Group 1");
            Assert.IsTrue(i1.Email == "*****@*****.**", "i1 does not equal email!");

            IAddress i2 = da.GetAddressInformation("CN=Internal1,OU=Engineering,O=Workshare,C=ZA");
            Assert.IsTrue(da.IsMemberOf(i2, i1), "Internal1 is a not a member when it should be!");

            IAddress i3 = da.GetAddressInformation("CN=Internal2/OU=Engineering/O=Workshare/C=ZA");
            Assert.IsTrue(da.IsMemberOf(i3, i1), "Internal2 is a not a member when it should be!");

        }
        public void Test_10_X500Address()
        {
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
            
            IAddress smtp = da.GetAddressInformation("*****@*****.**");
            IAddress x500Comma = da.GetAddressInformation("CN=DevBuild,OU=Engineering,O=Workshare,C=ZA");
            IAddress x500ForwardSlash = da.GetAddressInformation("CN=DevBuild/OU=Engineering/O=Workshare/C=ZA");

            Assert.IsTrue(smtp.Email == x500Comma.Email);
            Assert.IsTrue(smtp.Email == x500ForwardSlash.Email);
        }
        public void Test_17_ServerNotWorkingValidAddress()
        {
            Test_Helper.SetupNonWorkingDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            Assert.IsFalse(da.IsLdapAvailable, "LDAP should not be available, the server settings are deliberately wrong.");

            IAddress addr = da.GetAddressInformation("*****@*****.**");
            Assert.IsTrue(addr.AddressType == AddressType.Smtp, "It not a valid SMTP Address!");
            Assert.AreEqual(addr.Email, "*****@*****.**", "Address not the same");
        }
        public void Test_14_WSDevDomain()
        {
            Test_Helper.SetupWsDevDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
            
            string email =  "/o=WSDEV/ou=First Administrative Group/cn=Recipients/cn=lnpair";
            IAddress addr = da.GetAddressInformation(email);

            Assert.IsTrue(addr.AddressType == AddressType.Smtp, "The email address type is not correct!");
        }
        //TODO:  Get on an Active Directory course.
        public void Test_11_X500ADGroupAddress()
        {
            Test_Helper.SetupWsQADomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);
            
            IAddress i1 = da.GetAddressInformation("CN=QALocalAdmins,OU=Groups,OU=QA Accounts,OU=QA Control,DC=wsqa,DC=net");
            Assert.IsTrue(i1.Email == "CN=QALocalAdmins,OU=Groups,OU=QA Accounts,OU=QA Control,DC=wsqa,DC=net", "The email address was not resolved.");

            IAddress i2 = da.GetAddressInformation("CN=qaadmin1,OU=Users,OU=QA Accounts,OU=QA Control,DC=wsqa,DC=net");
            Assert.IsTrue(da.IsMemberOf(i2, i1), "The account [qaadmin1] was not found as a member in the mailing list [QALocalAdmins].");
        }
        public void Test_10_X500ExchangeAddress()
        {
            Test_Helper.SetupWsQADomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            IAddress i1 = da.GetAddressInformation("CN=qa1,OU=Users,OU=QA Accounts,OU=LN QA,OU=QA Control,DC=wsqa,DC=net");
            IAddress i2 = da.GetAddressInformation("*****@*****.**");
            IAddress i3 = da.GetAddressInformation("/o=wsqa/ou=First Administrative Group/cn=Recipients/cn=qa1");
            
            Assert.IsTrue(i1.Email == i2.Email, "i1 does not equal i2!");
            Assert.IsTrue(i2.Email == i3.Email, "i2 does not equal i3!");
        }