private Task <string> SendDelete(string url, UserCredentials userCredentials, int expectedCode)
        {
            var source = TaskCompletionSourceFactory.Create <string>();

            _client.Delete(url,
                           userCredentials,
                           response => {
                if (response.HttpStatusCode == expectedCode)
                {
                    source.SetResult(response.Body);
                }
                else
                {
                    source.SetException(new ProjectionCommandFailedException(
                                            response.HttpStatusCode,
                                            string.Format("Server returned {0} ({1}) for DELETE on {2}",
                                                          response.HttpStatusCode,
                                                          response.StatusDescription,
                                                          url)));
                }
            },
                           source.SetException);

            return(source.Task);
        }
Exemple #2
0
        public async void ShouldDeletePerson()
        {
            var success = await client.Delete("products/:id", new { id = 1 })
                          .On(HttpStatusCode.NotFound, () => throw new Exception("Could not find person to delete"))
                          .Is(HttpStatusCode.NoContent);

            Assert.True(success);
        }
Exemple #3
0
        /// <summary>
        /// Removes the results file from the server.
        /// <value>A Tuple in the form (<remove succeeded>, <error message>)</value>
        /// </summary>
        public virtual Tuple <bool, string> Remove()
        {
            var response = http.Delete(statusUrl);

            var     reader = new JsonReader();
            dynamic output = reader.Read(GetRawResponse(response));

            if (output != null && output.status == "error")
            {
                return(new Tuple <bool, string>(false, output.msg));
            }
            else
            {
                return(new Tuple <bool, string>(true, ""));
            }
        }
 public Task Delete(int id)
 => _httpClient.Delete <SentinelEntry>($"{BaseApi}/{id}");
Exemple #5
0
 protected override Task <string> GetUrlContent(string url)
 {
     return(httpClient.Delete(url));
 }
Exemple #6
0
 public void DeletePeer(string tsKey, Guid id)
 {
     _httpClient.Delete(_pgClient.ServiceUrl, $"api/v1/telephony/{tsKey}/{id}", _pgClient.Ticket);
 }