예제 #1
0
        public void testPutTracking()
        {
            Tracking tracking = new Tracking("00340433836621378669");

            tracking.slug  = "dhl-germany";
            tracking.title = "another title";

            Tracking tracking2 = connection.putTracking(tracking);

            Assert.AreEqual("another title", tracking2.title);

            //test post tracking number doesn't exist
            Tracking tracking3 = new Tracking(trackingNumberToDetectError);

            tracking3.title = "another title";

            try
            {
                connection.putTracking(tracking3);
                //always should give an exception before this
                Assert.AreEqual("This never should be executed", false);
            }
            catch (Exception e)
            {
                Assert.AreEqual("{\"meta\":{\"code\":404,\"message\":\"The URI requested is invalid or the resource requested does not exist.\",\"type\":\"NotFound\"},\"data\":{\"resource\":\"/v4/trackings//asdq\"}}", e.Message);
            }
        }