Exemplo n.º 1
0
        public void TestThatGetFilteredStringDialOnlyAllowsDigits()
        {
            string sTestString     = "ABCDEFGHIJKLMNOPQRSTUVWXYZ (123) 456-7890 abcdefghijklpmnopqrstuvwxyz ~`!@#$%^&*()_-+={[}}\\|:;\"'<,>.?/";
            string sExpectedString = "1234567890";

            Assert.That(StringFilter.GetFilteredStringDial(sTestString), Is.EqualTo(sExpectedString));
        }
Exemplo n.º 2
0
        public void TestThatGetFilteredStringDialCanHandleAnEmptyString()
        {
            string sTestString     = "";
            string sExpectedString = sTestString;

            Assert.That(StringFilter.GetFilteredStringDial(sTestString), Is.EqualTo(sExpectedString));
        }
Exemplo n.º 3
0
        public string DoesItContainPhoneNumber(string i_sPhoneNumber)
        {
            bool bExistsInDirectory = false;

            try
            {
                string sPhoneNumber = StringFilter.GetFilteredStringDial(i_sPhoneNumber);                   // Just to make sure we are only dealing with digits.


                // If we have more digits than are allowed for a valid extension then we know that
                // what we have is not a valid extension, so don't even bother to check against what
                // is in the DB.

                if (sPhoneNumber.Length <= m_iNumberOfDigitsInExtension)
                {
                    bExistsInDirectory = IsAKnownExtension(sPhoneNumber, m_iNumberOfDigitsInExtension);
                }


                // Only check Alternate Numbers if we didn't match any of the extensions in the DB.

                if (!bExistsInDirectory)
                {
                    bExistsInDirectory = IsAKnownAlternateNumber(sPhoneNumber);
                }
            }
            catch (Exception exc)
            {
                Log(Level.Exception, String.Format("UserDirectory.DoesItContainPhoneNumber({0}) caught exception: {1}", i_sPhoneNumber, exc.ToString()));
            }

            return(bExistsInDirectory ? "true" : "false");
        }