Skip to content

Commit cece499

Browse files
authored
Move EndShipper to general availability (#314)
- Copy EndShipper to GA - Mark EndShipper beta as obsolete - Introduce new custom attribute to note deprecation details - New EndShipperCollection class to wrap list of EndShipper objects (like Addresses) - EndShipper.All returns EndShipperCollection object - Unit tests updated
1 parent f21a944 commit cece499

File tree

13 files changed

+793
-11
lines changed

13 files changed

+793
-11
lines changed

EasyPost.Tests/EndShipperTest.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
3-
using EasyPost.Beta;
43
using Microsoft.VisualStudio.TestTools.UnitTesting;
54

65
namespace EasyPost.Tests
@@ -10,35 +9,34 @@ public class EndShipperTest
109
{
1110
private TestUtils.VCR _vcr;
1211

13-
// This (and all Beta features) cannot use VCR because of a known conflict between using a VCR/custom HttpClient and re-constructing RestSharp.
14-
1512
[TestInitialize]
1613
public void Initialize()
1714
{
1815
_vcr = new TestUtils.VCR("end_shipper", TestUtils.ApiKey.Production);
1916
}
2017

21-
[Ignore]
2218
[TestMethod]
2319
public async Task TestAll()
2420
{
2521
_vcr.SetUpTest("all");
2622

27-
List<EndShipper> endShippers = await EndShipper.All(new Dictionary<string, object>
23+
EndShipperCollection endShipperCollection = await EndShipper.All(new Dictionary<string, object>
2824
{
2925
{
3026
"page_size", Fixture.PageSize
3127
}
3228
});
3329

30+
List<EndShipper> endShippers = endShipperCollection.end_shippers;
31+
3432
Assert.IsTrue(endShippers.Count <= Fixture.PageSize);
33+
Assert.IsNotNull(endShipperCollection.has_more);
3534
foreach (var item in endShippers)
3635
{
3736
Assert.IsInstanceOfType(item, typeof(EndShipper));
3837
}
3938
}
4039

41-
[Ignore]
4240
[TestMethod]
4341
public async Task TestCreate()
4442
{
@@ -51,7 +49,6 @@ public async Task TestCreate()
5149
Assert.AreEqual("388 TOWNSEND ST APT 20", endShipper.street1);
5250
}
5351

54-
[Ignore]
5552
[TestMethod]
5653
public async Task TestRetrieve()
5754
{
@@ -65,24 +62,23 @@ public async Task TestRetrieve()
6562
Assert.AreEqual(endShipper.street1, retrievedEndShipper.street1);
6663
}
6764

68-
[Ignore]
6965
[TestMethod]
7066
public async Task TestUpdate()
7167
{
7268
_vcr.SetUpTest("update");
7369

7470
EndShipper endShipper = await CreateBasicEndShipper();
7571

76-
string newPhoneNumber = "9999999999";
72+
string newName = "NEW NAME"; // purposely all caps since the API validation will capitalize it in the reponse
7773

7874
Dictionary<string, object> endShipperData = Fixture.EndShipperAddress;
79-
endShipperData["phone"] = newPhoneNumber;
75+
endShipperData["name"] = newName;
8076

8177
await endShipper.Update(endShipperData);
8278

8379
Assert.IsInstanceOfType(endShipper, typeof(EndShipper));
8480
Assert.IsTrue(endShipper.id.StartsWith("es_"));
85-
Assert.AreEqual(newPhoneNumber, endShipper.phone);
81+
Assert.AreEqual(newName, endShipper.name);
8682
}
8783

8884
private static async Task<EndShipper> CreateBasicEndShipper()

EasyPost.Tests/cassettes/net/end_shipper/all.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EasyPost.Tests/cassettes/net/end_shipper/create.json

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EasyPost.Tests/cassettes/net/end_shipper/retrieve.json

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)