public void RatesFakeAPI() { HandlerAPI wrong_handler = new HandlerAPI(api_key: "123456789876543456", endpoint: endpoint_production_sandbox); //if the trackingNumber is bad informed dynamic request_data = new JObject(); request_data.shipper_accounts = shipper_account_production_sandbox_array; request_data.async = false; request_data.shipment = new JObject(); request_data.shipment.ship_from = address1; request_data.shipment.ship_to = address2; request_data.shipment.parcels = parcels1; try { wrong_handler.create(resource: "rates", payload: request_data); //shouldn't reach this point Assert.Equals(0, 1); } catch (PostmenException e) { Console.WriteLine(request_data.ToString()); Console.WriteLine("--------------------"); Console.WriteLine(e.Raw.ToString()); Assert.AreEqual(4105, e.Code); } }
public void RatesWrongCountry() { dynamic request_data = new JObject(); request_data.shipper_accounts = shipper_account_production_sandbox_array; request_data.async = false; request_data.shipment = new JObject(); request_data.shipment.ship_from = address1; request_data.shipment.ship_to = address_wrong_address; request_data.shipment.parcels = parcels1; try { handler_production_sandbox.create(resource: "rates", payload: request_data); //shouldn't reach this point Assert.Equals(0, 1); } catch (PostmenException e) { Console.WriteLine(request_data.ToString()); Console.WriteLine("--------------------"); Console.WriteLine(e.Raw.ToString()); Assert.AreEqual(4104, e.Code); } }