/// <summary> ///Get trackings from your account with the ParametersTracking defined in the params /// </summary> /// <param name="parameters"> ParametersTracking Object, with the information to get /// <returns> A List of Tracking Objects from your account. public List <Tracking> getTrackings(ParametersTracking parameters) { List <Tracking> trackingList = null; int size = 0; JObject response = this.request("GET", "/trackings?" + parameters.generateQueryString(), null); JArray trackingJSON = (JArray)response["data"]["trackings"]; if (trackingJSON.Count != 0) { size = (int)response["data"]["count"]; trackingList = new List <Tracking>(); for (int i = 0; i < trackingJSON.Count; i++) { trackingList.Add(new Tracking((JObject)trackingJSON[i])); } parameters.total = size; } return(trackingList); }
/// <summary> ///Get next page of Trackings from your account with the ParametersTracking defined in the params /// </summary> /// <param name="parameters"> ParametersTracking Object, with the information to get /// <returns> The next page of Tracking Objects from your account public List <Tracking> getTrackingsNext(ParametersTracking parameters) { parameters.page = parameters.page + 1; return(this.getTrackings(parameters)); }
public void testGetTrackings_H() { ParametersTracking param7 = new ParametersTracking(); param7.addOrigin(ISO3Country.ESP); // param7.setLimit(50); List<Tracking> totalOutDelivery5 = connection.getTrackings(param7); Assert.AreEqual(1, totalOutDelivery5.Count); }
public void testGetTrackings_F() { ParametersTracking param5 = new ParametersTracking(); param5.addField(FieldTracking.tracking_number); //param5.setLimit(50); List<Tracking> totalOutDelivery3 = connection.getTrackings(param5); Assert.AreEqual(null, totalOutDelivery3[0].title); }
public void testGetTrackings_G() { ParametersTracking param6 = new ParametersTracking(); param6.addField(FieldTracking.tracking_number); param6.addField(FieldTracking.title); param6.addField(FieldTracking.checkpoints); param6.addField(FieldTracking.order_id); param6.addField(FieldTracking.tag); param6.addField(FieldTracking.order_id); //param6.setLimit(50); List<Tracking> totalOutDelivery4 = connection.getTrackings(param6); Assert.AreEqual(null, totalOutDelivery4[0].slug); }
public void testGetTrackings_E() { ParametersTracking param4 = new ParametersTracking(); param4.keyword = "title"; param4.addField(FieldTracking.title); param4.limit = 50; List<Tracking> totalOutDelivery2 = connection.getTrackings(param4); // Assert.AreEqual( 2, totalOutDelivery2.Count); Assert.AreEqual("this title", totalOutDelivery2[0].title); }
public void testGetTrackings_D() { ParametersTracking param3 = new ParametersTracking(); param3.limit = 50; List<Tracking> totalOutDelivery1 = connection.getTrackings(param3); Assert.IsTrue(totalOutDelivery1.Count > 10); Assert.IsTrue(totalOutDelivery1.Count <= 50); }
public void testGetTrackings_C() { ParametersTracking param2 = new ParametersTracking(); param2.addTag(StatusTag.Delivered); param2.limit = 50; List<Tracking> totalOutDelivery = connection.getTrackings(param2); Assert.IsTrue(totalOutDelivery.Count > 10); Assert.IsTrue(totalOutDelivery.Count <= 50); }
public void testGetTrackings_B() { ParametersTracking param1 = new ParametersTracking(); param1.addDestination(ISO3Country.DEU); param1.limit = 20; List<Tracking> totalSpain = connection.getTrackings(param1); Assert.IsTrue(totalSpain.Count >=1); }
public void testGetTrackings_A() { ParametersTracking parameters = new ParametersTracking(); parameters.addSlug("dhl"); DateTime date = DateTime.Today.AddMonths(-1); parameters.createdAtMin = date; parameters.limit = 50; List<Tracking> totalDHL = connection.getTrackings(parameters); Assert.IsTrue(totalDHL.Count >= 1); }