Пример #1
0
        public static void PhoneIdContact(string[] args)
        {
            CheckArgument.ArrayLengthIs(args, 1, "args");
            string phoneNumber = args[0];

            PhoneIdService         service  = new PhoneIdService(GetConfiguration());
            PhoneIdContactResponse response = service.ContactLookup(phoneNumber);

            Console.WriteLine("Phone Number: {0}", phoneNumber);
            Console.WriteLine("Name        : {0}", response.Contact.FullName);
            Console.WriteLine("Address     :\r\n{0}", response.Contact.GetFullAddress());
        }
Пример #2
0
        public void TestPhoneIdContactWrapsParserErrors()
        {
            string message = "My exception message";
            IPhoneIdResponseParser parser = new FakeResponseParser()
            {
                ExpectedException = new Exception(message),
            };

            PhoneIdService service = this.CreateService(null, parser);

            Assert.Throws <ResponseParseException>(delegate
            {
                service.ContactLookup("15555555555");
            });
        }
Пример #3
0
        public static void MapContactLocation(string[] args)
        {
            CheckArgument.ArrayLengthIs(args, 1, "args");
            string phoneNumber = args[0];

            PhoneIdService         service  = new PhoneIdService(GetConfiguration());
            PhoneIdContactResponse response = service.ContactLookup(phoneNumber);

            string address = response.Contact.GetFullAddressOnSingleLine();

            Console.WriteLine("Google Mapping: {0}", address);

            string url = string.Format(
                "http://maps.google.com/maps?q={0}",
                address);

            Process.Start(url);
        }