예제 #1
0
        public void GetEmailAddresses_ShouldThrowExceptionOnNullFirstName()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);
            string firstName = "";
            string lastName  = "anything";

            target.GetEmailAddresses(firstName, lastName);
        }
예제 #2
0
        public void GetEmailAddresses_ShouldReturnCorrectEmailAddress()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);
            string        firstName        = "anything";
            string        lastName         = "anything";
            List <string> expected         = new List <string>();

            expected.Add("*****@*****.**");

            List <string> actual;

            actual = target.GetEmailAddresses(firstName, lastName);
            Assert.AreEqual(expected[0], actual[0]);
        }
예제 #3
0
        public void GetEmailAddresses_ShouldThrowExceptionOnNullLastNameWithCorrectDebugInformation()
        {
            IMyPrincipalSearcher  searcher = new FakePrincipalSearcher();
            ActiveDirectoryHelper target   = new ActiveDirectoryHelper(searcher);
            string firstName = "anything";
            string lastName  = "";

            try
            {
                target.GetEmailAddresses(firstName, lastName);
            }
            catch (ArgumentNullException ex)
            {
                Assert.IsTrue(ex.ParamName == "lastName");
                return;
            }

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