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

            PhoneIdService          service  = new PhoneIdService(GetConfiguration());
            PhoneIdStandardResponse response = service.StandardLookup(phoneNumber);
        }
Пример #2
0
        public void TestValidPhoneIdStandardParsing()
        {
            string json = this.LoadJsonFromFile("PhoneIdStandardValidResponse_AsSent.txt");

            PhoneIdStandardResponse response = this.CreateParser().ParsePhoneIdStandardResponse(json);

            Assert.AreEqual(response.Errors.Count, 0);
            Assert.AreEqual(response.ReferenceId, "01389064DBCE010BE1D449490000000E");
            Assert.AreEqual(response.ResourceUri, string.Empty);
            Assert.AreNotEqual(response.RawResponse, null);
            Assert.AreEqual(response.SubResource, "standard");

            Assert.AreEqual(response.Status.UpdatedOn, DateTime.Parse("2012-07-16T15:25:25.417924Z").ToUniversalTime());
            Assert.AreEqual(response.Status.Code, TransactionStatusCode.Success);
            Assert.AreEqual(response.Status.Description, "Transaction successfully completed");

            Assert.AreEqual(response.OriginalNumber.CompletePhoneNumber, "13107409700");
            Assert.AreEqual(response.OriginalNumber.CountryCode, "1");
            Assert.AreEqual(response.OriginalNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.CallCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.CallCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.CallCleansedNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.SmsCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.SmsCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.SmsCleansedNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.PhoneType.PhoneType, PhoneType.FixedLine);
            Assert.AreEqual(response.PhoneType.Description, "FIXED_LINE");

            Assert.AreEqual(response.Location.City, "Los Angeles");
            Assert.AreEqual(response.Location.State, "CA");
            Assert.AreEqual(response.Location.Zip, "90066");
            Assert.AreEqual(response.Location.MetroCode, "4480");
            Assert.AreEqual(response.Location.County, "Los Angeles");

            Assert.AreEqual(response.Location.Country.Name, "United States");
            Assert.AreEqual(response.Location.Country.Iso2, "US");
            Assert.AreEqual(response.Location.Country.Iso3, "USA");

            Assert.AreEqual(response.Location.Coordinates.Longitude, -118.42302);
            Assert.AreEqual(response.Location.Coordinates.Latitude, 33.99791);

            Assert.AreEqual(response.Location.TimeZoneRange.Name, "America/Los_Angeles");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMin, "-8");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMax, "-8");
        }
Пример #3
0
        public static void MapRegistrationLocation(string[] args)
        {
            CheckArgument.ArrayLengthIs(args, 1, "args");
            string phoneNumber = args[0];

            PhoneIdService          service  = new PhoneIdService(GetConfiguration());
            PhoneIdStandardResponse response = service.StandardLookup(phoneNumber);

            string url = string.Format(
                "http://maps.google.com/maps?q={0},{1}",
                response.Location.Coordinates.Latitude,
                response.Location.Coordinates.Longitude);

            Process.Start(url);
        }