示例#1
0
        public void TestAddresses()
        {
            var fromAddress = _client.CreateAddress(new Address
            {
                Name    = "EasyPost",
                Street1 = "2135 Sacramento St",
                City    = "San Francisco",
                State   = "CA",
                Zip     = "94109",
                Email   = "*****@*****.**",
            });

            Assert.IsNotNull(fromAddress.Id);

            var verified = _client.VerifyAddress(fromAddress.Id);

            Assert.IsNotNull(verified.Address.Id);

            var sameAsFrom = _client.GetAddress(fromAddress.Id);

            Assert.AreEqual(fromAddress.Id, sameAsFrom.Id);

            var allAddresses = _client.GetAddresses();
            var shouldExist  = allAddresses.SingleOrDefault(x => string.Equals(x.Id, fromAddress.Id));

            Assert.IsNotNull(shouldExist);
        }