Beispiel #1
0
        public void testDeleteTracking()
        {
            //delete a tracking number (posted in the setup)
            Tracking deleteTracking = new Tracking(trackingNumberDelete);

            deleteTracking.slug = slugDelete;
            Assert.IsTrue(connection.deleteTracking(deleteTracking), "#A18");
        }
        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**************");
            }
        }
Beispiel #3
0
        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**************");

            }
        }