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

            ADUser actual = target.GetEmailAddress("");
        }
예제 #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);
        }
예제 #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.");
        }