Ejemplo n.º 1
0
        public void TestPhoneNumberTypes()
        {
            var australia = _locationQuery.GetCountry("Australia");
            var india     = _locationQuery.GetCountry("India");

            Assert.AreEqual(PhoneNumberType.Mobile, _phoneNumbersQuery.GetPhoneNumberType("0412121212", australia));
            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("0512121212", australia));
            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("98888888", australia));
            Assert.AreEqual(PhoneNumberType.Mobile, _phoneNumbersQuery.GetPhoneNumberType("  0421323332", australia));

            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("0412121212", india));
            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("0512121212", india));
            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("98888888", india));
            Assert.AreEqual(PhoneNumberType.Work, _phoneNumbersQuery.GetPhoneNumberType("  0421323332", india));
        }
Ejemplo n.º 2
0
        protected override IList <PhoneNumber> GetPhoneNumbers(XmlDocument xmlDoc)
        {
            var phoneNumber = Get(xmlDoc, "//contact/phone");

            if (string.IsNullOrEmpty(phoneNumber))
            {
                return(null);
            }

            return(new List <PhoneNumber>
            {
                new PhoneNumber
                {
                    Number = phoneNumber,
                    Type = _phoneNumbersQuery.GetPhoneNumberType(phoneNumber, _locationQuery.GetCountry(Country)),
                }
            });
        }