public void RightPasswordTest()
        {
            AdUser user = new AdAuthenticator()
                .ConfigureSetLdapPath(LdapPath)
                .ConfigureLdapDomain(LdapDomain)
                .SearchUserBy(RightUser, RightPassword);

            Assert.IsNotNull(user);
            Assert.AreEqual(RightUser, user.Login);
        }
        public void RetrivesGroupsFromAdTest()
        {
            AdGroup[] groups = new AdAuthenticator()
                .ConfigureSetLdapPath(LdapPath)
                .ConfigureLdapDomain(LdapDomain)
                .GetAdGroups().ToArray();

            Assert.IsNotNull(groups);
            Assert.IsTrue(groups.Any());
            Assert.IsTrue(groups.Any(x => "Usuários do domínio".Equals(x.Code)));
        }
        public void RetrievesGroupsFromUserTest()
        {
            AdUser user = new AdAuthenticator()
                .ConfigureSetLdapPath(LdapPath)
                .ConfigureLdapDomain(LdapDomain)
                .SearchUserBy(RightUser, RightPassword);

            Assert.IsNotNull(user.AdGroups);
            Assert.IsTrue(user.AdGroups.Any());
            Assert.IsTrue(user.AdGroups.Any(x => "Usuários do domínio".Equals(x.Code)));
        }
        public void TestFindAllUsers()
        {
            var list = new AdAuthenticator()
                .ConfigureSetLdapPath(LdapPath)
                .ConfigureLdapDomain(LdapDomain)
                .GetAllUsers()
                .ToArray();

            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count() > 1);
            Assert.IsTrue(list.Any(u => string.Equals(u.Login, RightUser)));
        }
        public void TestFindUsersByFilter()
        {
            var ad = new AdAuthenticator()
                .ConfigureSetLdapPath(LdapPath)
                .ConfigureLdapDomain(LdapDomain);

            int total;
            var list = ad.GetUsersByFilter(RightUser.First().ToString(CultureInfo.InvariantCulture), 1, out total, 9999);
            Assert.IsNotNull(list);
            var adUsers = list as AdUser[] ?? list.ToArray();
            Assert.IsTrue(total >= adUsers.Count());
            Assert.IsTrue(adUsers.Any(u => string.Equals(u.Login, RightUser)));

            list = ad.GetUsersByFilter(RightUser.Last().ToString(CultureInfo.InvariantCulture), 1, out total, 9999);
            Assert.IsNotNull(list);
            adUsers = list as AdUser[] ?? list.ToArray();
            Assert.IsTrue(total >= adUsers.Count());
            Assert.IsTrue(adUsers.Any(u => string.Equals(u.Login, RightUser)));
        }
        public void TestGetLdapSettingFromConfig()
        {
            AdUser user = new AdAuthenticator().SearchUserBy(RightUser, RightPassword);

            Assert.IsNotNull(user);
            Assert.AreEqual(RightUser, user.Login);
        }
 public Validator(AdAuthenticator adAuthenticator)
 {
     _adAuthenticator = adAuthenticator;
 }