Ejemplo n.º 1
0
        public void LocationTranslateTest()
        {
            LocationTranslateResponse response = TencentMapApi.LocationTranslate("37.7360500000,112.5656600000", 1, key, secretKey);

            Assert.IsNotNull(response);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 2
0
        public void SearchAreaTest()
        {
            AreaResponse <List <List <Area> > > response = TencentMapApi.SearchAreas("山西", 0, "", key, secretKey);

            Assert.IsNotNull(response);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 3
0
        public void AreaTest()
        {
            AreaResponse <List <List <Area> > > response = TencentMapApi.GetAreas(key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Result.Count, 3);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 4
0
        public void DistanceTest()
        {
            var response = TencentMapApi.DistanceMatrix("driving", "37.7360500000,112.5656600000", "37.7360500000,117.5656600000", key, secretKey);

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Status == 0);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 5
0
        public void SonAreaTest()
        {
            AreaResponse <List <List <Area> > > response = TencentMapApi.GetSonAreas("110000", 2, "3000", key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Result.Count, 1);
            Assert.AreEqual(response.Result[0].Count, 16);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 6
0
        public void AddressToLocationTest()
        {
            MapResponse <AddressToLocationResponse> response = TencentMapApi.AddressToLocation("太原市小店区平阳景苑5号楼", "太原市", key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, successStatus);
            Assert.IsNotNull(response.Result);
            Assert.IsNotNull(response.Result.AdInfo);
            Assert.IsNotNull(response.Result.AddressComponent.City);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 7
0
        public void LocationToAddressTest()
        {
            MapLocationToAddressResponse <LocationToAddress> response = TencentMapApi.LocationToAddress("37.7360500000,112.5656600000", 1, "address_format=short", key, secretKey);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Status, successStatus);

            Assert.IsNotNull(response.Result);
            Assert.IsNotNull(response.Result.Address);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 8
0
        public void SearchTest()
        {
            var response = TencentMapApi.Search("大学", "region(太原,0)", "category=大学,中学", "_distance", 10, 1, key, secretKey);

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Status == 0);
            response = TencentMapApi.Search("大学", "nearby(37.7360500000,112.5656600000,1000)", "category=大学,中学", "_distance", 10, 1, key, secretKey);
            Assert.IsNotNull(response);
            Assert.IsTrue(response.Status == 0);
            response = TencentMapApi.Search("大学", "rectangle(39.907293,116.368935,39.914996,116.379321)", "category=大学,中学", "_distance", 10, 1, key, secretKey);
            Assert.IsNotNull(response);
            Assert.IsTrue(response.Status == 0);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }
Ejemplo n.º 9
0
        public void TencentMapApiTest()
        {
            MapResponse <IpLocationResult> response = TencentMapApi.IpLocation("210.12.186.82", key, secretKey);

            Assert.IsTrue(response.Status == successStatus);
            Assert.IsTrue(response.Message != null);
            Assert.IsTrue(response.Result.IP != null);
            Assert.IsTrue(response.Result.Location != null);
            Assert.IsTrue(response.Result.AdInfo != null);
            Assert.IsTrue(response.Result.AdInfo.Nation != null);
            Assert.IsTrue(response.Result.AdInfo.Province != null);
            Assert.IsTrue(response.Result.AdInfo.City != null);
            Assert.IsTrue(response.Result.AdInfo.District != null);
            Assert.IsTrue(response.Result.AdInfo.AdCode > 0);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(response.Body));
        }