Ejemplo n.º 1
0
        public static async Task <ShippoCollection <Rate> > GetDefaultObject()
        {
            Shipment testObject = await ShipmentTest.GetDefaultObject();

            // Use Synchronized rates method
            return(await GetShippoClient().GetShippingRatesSync(testObject.ObjectId, "USD"));
        }
Ejemplo n.º 2
0
        public void testValidRetrieve()
        {
            Shipment testObject = ShipmentTest.getDefaultObject();
            Shipment retrievedObject;

            retrievedObject = apiResource.RetrieveShipment((string)testObject.ObjectId);
            Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId);
        }
Ejemplo n.º 3
0
        public async Task TestValidRetrieve()
        {
            Shipment testObject = await ShipmentTest.GetDefaultObject();

            Shipment retrievedObject;

            retrievedObject = await shippoClient.RetrieveShipment(testObject.ObjectId);

            Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId);
        }
Ejemplo n.º 4
0
        public static ShippoCollection<Rate> getDefaultObject ()
        {
            Shipment testObject = ShipmentTest.getDefaultObject ();
            Hashtable parameters = new Hashtable ();
            parameters.Add ("id", testObject.ObjectId);
            parameters.Add ("currency_code", "USD");

            // Use Synchronized rates method
            return getAPIResource ().GetShippingRatesSync (parameters);
        }
Ejemplo n.º 5
0
        public void TestValidAddShipmentToBatch()
        {
            Batch batch = getDefaultObject();

            Assert.AreEqual(batch.Status, ShippoEnums.Statuses.VALIDATING);

            List <String> shipmentIds = new List <String> ();
            Shipment      shipment    = ShipmentTest.getDefaultObject();

            shipmentIds.Add(shipment.ObjectId);

            Batch retrieve = getValidBatch(batch.ObjectId);
            Batch newBatch = getAPIResource().AddShipmentsToBatch(retrieve.ObjectId, shipmentIds);

            Assert.AreEqual(retrieve.BatchShipments.Count + shipmentIds.Count, newBatch.BatchShipments.Count);
        }
Ejemplo n.º 6
0
        public async Task TestValidAddShipmentToBatch()
        {
            Batch batch = await GetDefaultObject();

            Assert.AreEqual(batch.Status, ShippoEnums.Statuses.VALIDATING);

            Shipment shipment = await ShipmentTest.GetDefaultObject();

            Batch retrieve = await GetValidBatch(batch.ObjectId);

            Batch newBatch = await GetShippoClient().AddShipmentsToBatch(retrieve.ObjectId, new CreateBatchShipment[] {
                new CreateBatchShipment
                {
                    Shipment = shipment.ObjectId
                }
            });

            Assert.AreEqual(retrieve.BatchShipments.Count + 1, newBatch.BatchShipments.Count);
        }
Ejemplo n.º 7
0
        public void TestValidRemoveShipmentsFromBatch()
        {
            Batch batch = getDefaultObject();

            Assert.AreEqual(batch.Status, ShippoEnums.Statuses.VALIDATING);

            List <String> shipmentIds = new List <String> ();
            Shipment      shipment    = ShipmentTest.getDefaultObject();

            shipmentIds.Add(shipment.ObjectId);

            Batch retrieve = getValidBatch(batch.ObjectId);
            Batch addBatch = getAPIResource().AddShipmentsToBatch(retrieve.ObjectId, shipmentIds);

            string        removeId          = addBatch.BatchShipments.Results [0].ObjectId;
            List <String> shipmentsToRemove = new List <String> ();

            shipmentsToRemove.Add(removeId);

            Batch removeBatch = getAPIResource().RemoveShipmentsFromBatch(batch.ObjectId, shipmentsToRemove);

            Assert.AreEqual(retrieve.BatchShipments.Count, removeBatch.BatchShipments.Count);
        }
Ejemplo n.º 8
0
        public async Task TestValidRemoveShipmentsFromBatch()
        {
            Batch batch = await GetDefaultObject();

            Assert.AreEqual(batch.Status, ShippoEnums.Statuses.VALIDATING);

            var      shipmentIds = new List <string>();
            Shipment shipment    = await ShipmentTest.GetDefaultObject();

            shipmentIds.Add(shipment.ObjectId);

            Batch retrieve = await GetValidBatch(batch.ObjectId);

            Batch addBatch = await GetShippoClient().AddShipmentsToBatch(retrieve.ObjectId, shipmentIds);

            string removeId          = addBatch.BatchShipments.Results[0].ObjectId;
            var    shipmentsToRemove = new List <string>();

            shipmentsToRemove.Add(removeId);

            Batch removeBatch = await GetShippoClient().RemoveShipmentsFromBatch(batch.ObjectId, shipmentsToRemove);

            Assert.AreEqual(retrieve.BatchShipments.Count, removeBatch.BatchShipments.Count);
        }
Ejemplo n.º 9
0
        public async Task TestValidCreate()
        {
            Shipment testObject = await ShipmentTest.GetDefaultObject();

            Assert.AreEqual(ShippoEnums.ShippingStatuses.SUCCESS, testObject.Status);
        }
Ejemplo n.º 10
0
        public void TestValidCreate()
        {
            Shipment testObject = ShipmentTest.getDefaultObject();

            Assert.AreEqual("SUCCESS", testObject.Status);
        }
Ejemplo n.º 11
0
        public void TestValidCreate()
        {
            Shipment testObject = ShipmentTest.getDefaultObject();

            Assert.AreEqual("VALID", testObject.ObjectState);
        }