public async Task CreateGeoDataAndUpdateSuccessTest()
        {
            var geoData = new CreateGeoDataRequest();

            geoData.GeoData = new Location()
            {
                Latitude   = 49.9935,
                Longtitude = 36.23038,
                Status     = "TestUpdate"
            };

            var response = await this.client.LocationClient.CreateGeoDataAsync(geoData);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
            Assert.IsNotNull(response.Result);

            var updateData = new UpdateGeoDataRequest();

            updateData.GeoData = new Location()
            {
                Latitude   = 13.9935,
                Longtitude = 25.345,
                Status     = "TestUpdate2"
            };

            var updateResponse = await this.client.LocationClient.UpdateGeoDataAsync(response.Result.GeoDatum.Id, updateData);

            Assert.AreEqual(updateResponse.StatusCode, HttpStatusCode.OK);
            Assert.IsNotNull(updateResponse.Result);
        }
        public async Task DeleteGeoDataByIdSuccessTest()
        {
            var geoData = new CreateGeoDataRequest();

            geoData.GeoData = new Location()
            {
                Latitude   = 49.9935,
                Longtitude = 36.23038,
                Status     = "Test delete by id"
            };

            var response = await this.client.LocationClient.CreateGeoDataAsync(geoData);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
            Assert.IsNotNull(response.Result);

            // DELETE
            var deleteResponse = await this.client.LocationClient.DeleteGeoDataById(response.Result.GeoDatum.Id);

            Assert.AreEqual(deleteResponse.StatusCode, HttpStatusCode.OK);

            // Check if presents
            var getResponse = await this.client.LocationClient.GetGeoDataByIdAsync(response.Result.GeoDatum.Id);

            Assert.AreNotEqual(getResponse.StatusCode, HttpStatusCode.OK);
        }
Example #3
0
        /// <summary>
        /// Create geodata which represent points on the earth
        /// </summary>
        /// <param name="createGeodataRequest">The create geodata request.</param>
        /// <returns>Success HTTP Status Code 201</returns>
        public async Task <HttpResponse <GeoDatumResponse> > CreateGeoDataAsync(CreateGeoDataRequest createGeoDataRequest)
        {
            var headers = RequestHeadersBuilder.GetDefaultHeaders().GetHeaderWithQbToken(this.quickbloxClient.Token);
            var createGeodataResponse = await HttpService.PostAsync <GeoDatumResponse, CreateGeoDataRequest>(this.quickbloxClient.ApiEndPoint,
                                                                                                             QuickbloxMethods.CreateGeoDataMethod,
                                                                                                             createGeoDataRequest,
                                                                                                             headers);

            return(createGeodataResponse);
        }
        public async Task CreateGeoDataSuccessTest()
        {
            var geoData = new CreateGeoDataRequest();

            geoData.GeoData = new Location()
            {
                Latitude   = 49.9935,
                Longtitude = 36.23038
            };

            var response = await this.client.LocationClient.CreateGeoDataAsync(geoData);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
            Assert.IsNotNull(response.Result);
        }
        public async Task GetGeoDataByIdSuccessTest()
        {
            var geoData = new CreateGeoDataRequest();

            geoData.GeoData = new Location()
            {
                Latitude   = 49.9935,
                Longtitude = 36.23038,
                Status     = "Test get by id"
            };

            var response = await this.client.LocationClient.CreateGeoDataAsync(geoData);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
            Assert.IsNotNull(response.Result);


            var getResponse = await this.client.LocationClient.GetGeoDataByIdAsync(response.Result.GeoDatum.Id);

            Assert.AreEqual(getResponse.StatusCode, HttpStatusCode.OK);
            Assert.IsNotNull(getResponse.Result);
            Assert.AreEqual(geoData.GeoData.Status, getResponse.Result.GeoData.Status);
        }