Ejemplo n.º 1
0
        [Ignore] // TODO this uses the example tracking codes from the API docs, but the request fails :(
        public void TestRefunds()
        {
            var refunds = _client.CreateRefund(new RefundRequest
            {
                Carrier       = "USPS",
                TrackingCodes = new List <string> {
                    "CJ123456789US", "LN123456789US"
                }
            });

            Assert.IsTrue(refunds.Count == 2);

            // one of the two should exist
            var refundId = string.IsNullOrEmpty(refunds[0].Id) ? refunds[1].Id : refunds[0].Id;

            Assert.IsNotNull(refundId);

            var sameAsRefund = _client.GetRefund(refundId);

            Assert.AreEqual(refundId, sameAsRefund.Id);

            var allRefunds  = _client.GetRefunds();
            var shouldExist = allRefunds.SingleOrDefault(x => string.Equals(x.Id, refundId));

            Assert.IsNotNull(shouldExist);
        }