public void setUp() { if (firstTime) { Console.WriteLine("****************SET-UP BEGIN**************"); firstTime = false; //delete the tracking we are going to post (in case it exist) Tracking tracking = new Tracking("05167019264110"); tracking.slug = "dpd"; //first courier firstCourier.Add("slug", "india-post-int"); firstCourier.Add("name", "India Post International"); firstCourier.Add("phone", "+91 1800 11 2011"); firstCourier.Add("other_name", "भारतीय डाक, Speed Post & eMO, EMS, IPS Web"); firstCourier.Add("web_url", "http://www.indiapost.gov.in/"); //first courier in your account firstCourierAccount.Add("slug", "usps"); firstCourierAccount.Add("name", "USPS"); firstCourierAccount.Add("phone", "+1 800-275-8777"); firstCourierAccount.Add("other_name", "United States Postal Service"); firstCourierAccount.Add("web_url", "https://www.usps.com"); try { connection.deleteTracking(tracking); } catch (Exception e) { Console.WriteLine("**1" + e.Message); } Tracking tracking1 = new Tracking(trackingNumberToDetect); tracking1.slug = "dpd"; try{ connection.deleteTracking(tracking1); } catch (Exception e) { Console.WriteLine("**2" + e.Message); } try{ Tracking newTracking = new Tracking(trackingNumberDelete); newTracking.slug = slugDelete; connection.createTracking(newTracking); }catch (Exception e) { Console.WriteLine("**3" + e.Message); } try{ Tracking newTracking1 = new Tracking("9400110897700003231250"); newTracking1.slug = "usps"; connection.createTracking(newTracking1); }catch (Exception e) { Console.WriteLine("**4" + e.Message); } Console.WriteLine("****************SET-UP FINISH**************"); } }
public void TestCreateTracking() { Tracking tracking1 = new Tracking(trackingNumberPost); tracking1.slug = slugPost; tracking1.orderIDPath = orderIDPathPost; tracking1.customerName = customerNamePost; tracking1.orderID = orderIDPost; tracking1.title = titlePost; tracking1.destinationCountryISO3 = countryDestinationPost; tracking1.addEmails(email1Post); tracking1.addEmails(email2Post); tracking1.addCustomFields("product_name", customProductNamePost); tracking1.addCustomFields("product_price", customProductPricePost); tracking1.addSmses(sms1Post); tracking1.addSmses(sms2Post); Tracking trackingPosted = connection.createTracking(tracking1); Assert.AreEqual(trackingNumberPost, trackingPosted.trackingNumber, "#A01"); Assert.AreEqual(slugPost, trackingPosted.slug, "#A02"); Assert.AreEqual(orderIDPathPost, trackingPosted.orderIDPath, "#A03"); Assert.AreEqual(orderIDPost, trackingPosted.orderID, "#A04"); Assert.AreEqual(countryDestinationPost, trackingPosted.destinationCountryISO3, "#A05"); Assert.IsTrue(trackingPosted.emails.Contains(email1Post), "#A06"); Assert.IsTrue(trackingPosted.emails.Contains(email2Post), "#A07"); Assert.AreEqual(2, trackingPosted.emails.Count, "#A08"); Assert.IsTrue(trackingPosted.smses.Contains(sms1Post), "#A09"); Assert.IsTrue(trackingPosted.smses.Contains(sms2Post), "#A10"); Assert.AreEqual(2, trackingPosted.smses.Count, "#A11"); Assert.AreEqual(customProductNamePost, trackingPosted.customFields["product_name"], "#A12"); Assert.AreEqual(customProductPricePost, trackingPosted.customFields["product_price"], "#A13"); }
public void setUp() { String key = System.IO.File.ReadAllText(@"\\psf\Home\Documents\aftership-key.txt"); connection = new ConnectionAPI(key); if (firstTime) { Console.WriteLine("****************SET-UP BEGIN**************"); firstTime = false; //delete the tracking we are going to post (in case it exist) Tracking tracking = new Tracking("05167019264110"); tracking.slug = "dpd"; //first courier firstCourier.Add("slug", "india-post-int"); firstCourier.Add("name", "India Post International"); firstCourier.Add("phone", "+91 1800 11 2011"); firstCourier.Add("other_name", "भारतीय डाक, Speed Post & eMO, EMS, IPS Web"); firstCourier.Add("web_url", "http://www.indiapost.gov.in/"); //first courier in your account firstCourierAccount.Add("slug", "usps"); firstCourierAccount.Add("name", "USPS"); firstCourierAccount.Add("phone", "+1 800-275-8777"); firstCourierAccount.Add("other_name", "United States Postal Service"); firstCourierAccount.Add("web_url", "https://www.usps.com"); try { connection.deleteTracking(tracking); } catch (Exception e) { Console.WriteLine("**1" + e.Message); } Tracking tracking1 = new Tracking(trackingNumberToDetect); tracking1.slug = "dpd"; try { connection.deleteTracking(tracking1); } catch (Exception e) { Console.WriteLine("**2" + e.Message); } try { Tracking newTracking = new Tracking(trackingNumberDelete); newTracking.slug = slugDelete; connection.createTracking(newTracking); } catch (Exception e) { Console.WriteLine("**3" + e.Message); } try { Tracking newTracking1 = new Tracking("9400110897700003231250"); newTracking1.slug = "usps"; connection.createTracking(newTracking1); } catch (Exception e) { Console.WriteLine("**4" + e.Message); } Console.WriteLine("****************SET-UP FINISH**************"); } }