-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAddressInfoTests.cs
More file actions
68 lines (59 loc) · 2.71 KB
/
Copy pathAddressInfoTests.cs
File metadata and controls
68 lines (59 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PostcodeAPI.Model;
using PostcodeAPI.Wrappers;
namespace PostcodeAPI.Tests
{
[TestClass]
public class AddressInfoTests : TestBase
{
[TestMethod]
public void GetSingleAddress()
{
PostcodeApiClient client = new PostcodeApiClient(ApiKey);
Address address = client.GetAddressInfo("0268200000075156");
Assert.IsNotNull(address);
Assert.IsNotNull(address.Geo.GeographicCenter);
Assert.IsNotNull(address.Geo.GeographicExterior);
Assert.AreEqual(1, address.Geo.GeographicExterior.WGSCoordinates.Coordinates.Count);
Assert.AreEqual(5, address.Geo.GeographicExterior.WGSCoordinates.Coordinates[0].Count);
Assert.AreEqual(2, address.Geo.GeographicExterior.WGSCoordinates.Coordinates[0][1].Count);
}
[TestMethod]
public void GetSpecificAddress()
{
PostcodeApiClient client = new PostcodeApiClient(ApiKey);
ApiHalResultWrapper result = client.GetAddress("1446WP", 106);
Assert.IsNotNull(result);
Assert.IsNotNull(result.Links.Self);
Assert.AreEqual(1, result.Embedded.Addresses.Count);
Assert.AreEqual("Component", result.Embedded.Addresses[0].Street);
Assert.AreEqual("Purmerend", result.Embedded.Addresses[0].City.Label);
Assert.AreEqual(1997, result.Embedded.Addresses[0].Year);
Assert.AreEqual(682, result.Embedded.Addresses[0].SurfaceArea);
}
[TestMethod]
public void GetAddressRange()
{
PostcodeApiClient client = new PostcodeApiClient(ApiKey);
ApiHalResultWrapper result = client.GetAddress("1446WP");
Assert.IsNotNull(result);
Assert.IsNotNull(result.Links.Self);
Assert.IsNull(result.Links.Next);
Assert.IsTrue(result.Embedded.Addresses.Count > 1);
Assert.AreEqual("Component", result.Embedded.Addresses[0].Street);
Assert.AreEqual("Purmerend", result.Embedded.Addresses[0].City.Label);
}
[TestMethod]
public void GetLargeAddressRange()
{
PostcodeApiClient client = new PostcodeApiClient(ApiKey);
ApiHalResultWrapper result = client.GetAddress("1097JR");
Assert.IsNotNull(result);
Assert.IsNotNull(result.Links.Self);
Assert.IsNotNull(result.Links.Next);
Assert.IsTrue(result.Embedded.Addresses.Count == 20);
Assert.AreEqual("Pierre Lallementstraat", result.Embedded.Addresses[0].Street);
Assert.AreEqual("Amsterdam", result.Embedded.Addresses[0].City.Label);
}
}
}