Ejemplo n.º 1
0
        public async Task <string> PickupBooking_PostAsync(BookPickupRequest request)
        {
            HttpResponseMessage response = await Common.GetHttpClient(API_TOKEN).PostAsJsonAsync("api/bookpickup", request);

            if (response.IsSuccessStatusCode)
            {
                return(response.Content.ReadAsStringAsync().Result);
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("{0} ({1}) - {2}", (int)response.StatusCode, response.ReasonPhrase, response.Content.ReadAsStringAsync().Result);
                throw new HttpRequestException(sb.ToString());
            }
        }
Ejemplo n.º 2
0
        public void CreateDomesticOutboundShipmentWithPreRating()
        {
            GoSweetSpotApiClient client = new GoSweetSpotApiClient(api_token);

            var req = new BookPickupRequest()
            {
                Carrier = "FedEx",
                Parts   = 0,
                TotalKg = 0
            };

            req.Consignments = new List <string>();
            req.Consignments.Add("ABC123");
            req.Consignments.Add("ABC124");

            /* Warning - This will book a real courier to come for collection for the job */
            string result = "";

            //result = client.PickupBooking_PostAsync(req).Result;

            Assert.IsTrue(result.Contains("success"));
        }