public void Test_04_AddressRange()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     string[] emails = { "*****@*****.**", "*****@*****.**" };
     IAddressCollection ac = da.GetAddressCollectionInformation(emails);
     Assert.IsTrue(ac.Count == 2, "The number of emails does not match");
     Assert.AreEqual(ac["*****@*****.**"].DisplayName, "DevBuild", "The display names are not the same");
     Assert.AreEqual(ac["*****@*****.**"].DisplayName, "Internal1", "The display names are not the same");
 }
        public void Test_04_AddressRange()
        {
            Test_Helper.SetupWsQADomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            string[] emails = { "*****@*****.**", "*****@*****.**" };
            IAddressCollection ac = da.GetAddressCollectionInformation(emails);
            
            Assert.IsTrue(ac.Count == 2, "The number of emails does not match");
            Assert.AreEqual(ac["*****@*****.**"].DisplayName, "qa1", "The display names are not the same");
            Assert.AreEqual(ac["*****@*****.**"].DisplayName, "QA Admin", "The display names are not the same");
        }
 public void Test_05_SimpleCheck_Pass()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     string[] emails = { "*****@*****.**", "*****@*****.**" };
     IAddressCollection addrs = da.GetAddressCollectionInformation(emails);
     string[] policyList = { "*****@*****.**", "*****@*****.**", "*****@*****.**" };
     IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
     Assert.IsTrue(da.IsMemberOf(addrs, policies), "The emails are failing when they should not!");
 }
 public void Test_13_GetGroupByName()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     IAddressCollection name = da.GetAddressCollectionInformation("External", FieldType.Name);
     Assert.IsTrue(name.Count > 0, "The number of members found is not as expected!");
 }
 public void Test_12_GetMemberByField()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     IAddressCollection smtp = da.GetAddressCollectionInformation("*****@*****.**", FieldType.SmtpEmail);
     Assert.IsTrue(smtp.Count > 0, "The number of members found is not as expected!");
     
     IAddressCollection smptf = da.GetAddressCollectionInformation("pairjjjjjj", FieldType.SmtpEmail);
     Assert.IsTrue(smptf.Count == 0, "The number of members found should be zero!");
     
     IAddressCollection x500 = da.GetAddressCollectionInformation("Internal1", FieldType.X500Email);
     Assert.IsTrue(x500.Count > 0, "The number of members found is not as expected!");
     
     IAddressCollection name = da.GetAddressCollectionInformation("internal1", FieldType.Name);
     Assert.IsTrue(name.Count > 0, "The number of members found is not as expected!");
 }
 public void Test_09_CaseInsensitive()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     string[] emails = {"*****@*****.**", "*****@*****.**"  };
     
     IAddressCollection addrs = da.GetAddressCollectionInformation(emails);
     string[] policyList = { "*****@*****.**", "*****@*****.**", "*****@*****.**" };
     IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
     Assert.IsTrue(da.IsMemberOf(addrs, policies), "The emails are failing when they should not!");
 }
 public void Test_08_WildCardCheck_Fail()
 {
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
     string[] emails = { "*****@*****.**", "*****@*****.**" };
     IAddressCollection addrs = da.GetAddressCollectionInformation(emails);
     string[] policyList = { "*@workshare.com" };
     IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
     Assert.IsFalse(da.IsMemberOf(addrs, policies), "The emails are not failing when they should!");
 }
 public void Test_05_SimpleCheck_Pass()
 {
     Test_Helper.SetupWsQADomain();
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
 
     string[] emails = { "*****@*****.**", "*****@*****.**" };
     IAddressCollection addrs = da.GetAddressCollectionInformation(emails);
     
     string[] policyList = { "*****@*****.**", "*****@*****.**"};
     IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
     
     Assert.IsTrue(da.IsMemberOf(addrs, policies), "The emails are failing when they should not!");
 }
        public void Test_18_ServerNotWorkingValidAddresses()
        {
            Test_Helper.SetupNonWorkingDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

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

            string[] emails = { "*****@*****.**", "*****@*****.**" };
            IAddressCollection ac = da.GetAddressCollectionInformation(emails);

            Assert.IsTrue(ac.Count == 2, "The number of emails does not match");
        }
        public void Test_16_TestFindGroupByName()
        {
            Test_Helper.SetupWsDevDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            IAddressCollection addrs = da.GetAddressCollectionInformation("InternalServerDistributionList", FieldType.Name);

            Assert.IsNotNull(addrs, "Should return a non-null IAddressCollection");
            Assert.IsTrue(addrs.Count == 1, "Should have returned exactly one IAddress matching the search");
        }
        public void Test_15_GetNotFound()
        {
            Test_Helper.SetupWsDevDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            string[] emails = { "*****@*****.**", "*****@*****.**" };
            IAddressCollection addrs = da.GetAddressCollectionInformation(emails);

            string[] policyList = { "*****@*****.**" };
            IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
            
            addrs.ContainMembersOf(policies);
            string[] notFound = addrs.GetAddresses(false);
            Assert.IsTrue(notFound.Length == 1, "The number of not found is not correct!");
        }
        public void Test_13_Everyone_Pass()
        {
            Test_Helper.SetupWsDevDomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            string[] emails = { "*****@*****.**" };
            IAddressCollection addrs = da.GetAddressCollectionInformation(emails);

            string[] policyList = { "*****@*****.**" };
            IAddressCollection policies = da.GetAddressCollectionInformation(policyList);

            Assert.IsTrue(da.IsMemberOf(addrs, policies), "The emails are failing when they should not!");
        }
        public void Test_12_GetMemberByField()
        {
            Test_Helper.SetupWsQADomain();
            DirectoryAnalyzer da = new DirectoryAnalyzer(true);

            IAddressCollection smtp = da.GetAddressCollectionInformation("*****@*****.**", FieldType.SmtpEmail);
            Assert.IsTrue(smtp.Count > 0, "The number of members found is not as expected!");

            IAddressCollection invalidSmtp = da.GetAddressCollectionInformation("phantom", FieldType.SmtpEmail);
            Assert.IsTrue(invalidSmtp.Count == 0, "The number of members found should be zero!");

            IAddressCollection x500 = da.GetAddressCollectionInformation("qaadmin1", FieldType.X500Email);
            Assert.IsTrue(x500.Count > 0, "The number of members found is not as expected!");

            IAddressCollection name = da.GetAddressCollectionInformation("qaadmin1", FieldType.Name);
            Assert.IsTrue(name.Count > 0, "The number of members found is not as expected!");
        }
 public void Test_08_WildCardCheck_Fail()
 {
     Test_Helper.SetupWsQADomain();
     DirectoryAnalyzer da = new DirectoryAnalyzer(true);
 
     string[] emails = { "*****@*****.**", "*****@*****.**" };
     IAddressCollection addrs = da.GetAddressCollectionInformation(emails);
     
     string[] policyList = { "*@workshare.net" };
     IAddressCollection policies = da.GetAddressCollectionInformation(policyList);
     
     Assert.IsFalse(da.IsMemberOf(addrs, policies), "The emails are not failing when they should!");
 }