Exemplo n.º 1
0
        public void InpostLocker_ForceError_Case__ReciverPhoneMissing()
        {
            ShipXClient client = Helper.GetShipXClient();

            var tstReciver = new Faker <Receiver>("pl");

            tstReciver.RuleFor(r => r.email, f => f.Internet.Email())
            .RuleFor(r => r.phone, "");

            var tstCustomAtrr = new Faker <CustomAttributes>("pl")
                                .RuleFor(r => r.sending_method, SendingMethodEnum.dispatch_order.ToString())
                                .RuleFor(r => r.target_point, "WOL04A");


            var tstShipment = new Faker <Shipment>("pl")
                              .RuleFor(r => r.reference, f => f.Random.Hash(10))
                              .RuleFor(f => f.service, ServiceEnum.inpost_locker_allegro.ToString())
                              .RuleFor(f => f.receiver, tstReciver)
                              .RuleFor(f => f.custom_attributes, tstCustomAtrr);

            Result <Shipment> result = client.CreateShipment(tstShipment);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Error);
            Assert.AreNotEqual(0, result.Error.details.receiver[0].phone.Count);
        }
Exemplo n.º 2
0
 public void CreateClient_NoCredentials_ShouldFail()
 {
     try
     {
         _client = new ShipXClient(null, null);
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is Exception);
     }
 }
Exemplo n.º 3
0
        public void CreateClient_ShouldOK()
        {
            try
            {
                string orgId = _iniParser.GetValue("ORG");
                string token = _iniParser.GetValue("TOKEN");

                _client = new ShipXClient(orgId, token);

                Assert.IsNotNull(_client);
            }
            catch (Exception ex)
            {
                Assert.IsFalse(ex is Exception);
            }
        }
Exemplo n.º 4
0
        public void GetValidShipXClient_ShouldNotNull()
        {
            ShipXClient client = Helper.GetShipXClient();

            Assert.IsNotNull(Helper.GetShipXClient());
        }