コード例 #1
0
        public void TestCustoms()
        {
            var customsItem = _client.CreateCustomsItem(new CustomsItem
            {
                Description    = "testing",
                Quantity       = 1,
                Value          = 100,
                WeightOunces   = 16,
                HsTariffNumber = "123456",
                OriginCountry  = "US",
            });

            Assert.IsNotNull(customsItem.Id);

            var sameAsCustomsItem = _client.GetCustomsItem(customsItem.Id);

            Assert.AreEqual(sameAsCustomsItem.Id, customsItem.Id);

            var allCustomsItems = _client.GetCustomsItems();
            var shouldExistItem = allCustomsItems.SingleOrDefault(x => string.Equals(x.Id, customsItem.Id));

            Assert.IsNotNull(shouldExistItem);

            var customsInfo = _client.CreateCustomsInfo(new CustomsInfo
            {
                CustomsCertify      = true,
                CustomsSigner       = "Jonathan Calhoun",
                ContentsType        = "merchandise",
                ContentsExplanation = " ",
                RestrictionType     = "none",
                EelPfc       = "NOEEI 30.37(a)",
                CustomsItems = new List <CustomsItem> {
                    customsItem
                },
            });

            Assert.IsNotNull(customsInfo.Id);

            var sameAsCustomsInfo = _client.GetCustomsInfo(customsInfo.Id);

            Assert.AreEqual(sameAsCustomsInfo.Id, customsInfo.Id);

            var allCustomsInfos = _client.GetCustomsInfos();
            var shouldExistInfo = allCustomsInfos.SingleOrDefault(x => string.Equals(x.Id, customsInfo.Id));

            Assert.IsNotNull(shouldExistInfo);
        }