Beispiel #1
0
        public void GetEmailAddress_ShouldThrowExceptionOnNullAccountName()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);

            ADUser actual = target.GetEmailAddress("");
        }
Beispiel #2
0
        public void GetEmailAddress_ShouldReturnADUserWithCorrectEmailAddress()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);
            ADUser expectedUser            = new ADUser()
            {
                Email = "*****@*****.**",
            };

            ADUser actual = target.GetEmailAddress("77777777");

            Assert.AreEqual(expectedUser.Email, actual.Email);
        }
Beispiel #3
0
        public void GetEmailAddress_ShouldThrowExceptionOnNullAccountNameWithCorrectDebugInformation()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);

            try
            {
                ADUser actual = target.GetEmailAddress("");
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "samAccountName");
                return;
            }

            Assert.Fail("ArgumentNullException was not thrown.");
        }