예제 #1
0
 public async void LoadByIdSucceeds()
 {
     var service = new SubdivisionService();
     var subdiv = await service.LoadById(1001101);
     Assert.That(subdiv.Id, Is.GreaterThan(0));
     Assert.That(subdiv.Population, Is.Not.Null);
     Assert.That(subdiv.GeoJSON, Is.Not.Null);
 }
예제 #2
0
 public async void GetStoreByGeoJsonTest()
 {
     var subdivService = new SubdivisionService();
     var subdiv = await subdivService.LoadById(3501005);
     var storesService = new LcboService();
     var stores = await storesService.StoresInArea(subdiv.GeoJSON);
     Assert.That(stores.Count, Is.GreaterThan(0));
 }
예제 #3
0
 public async void Load100Succeeds()
 {
     var service = new SubdivisionService();
     var subdivs = await service.Load100();
     Assert.That(subdivs.Count(), Is.EqualTo(100));
     Assert.That(subdivs.All(s => s.Id > 0));
     Assert.That(subdivs.All(s => s.Population.HasValue));
     Assert.That(subdivs.All(s => !string.IsNullOrWhiteSpace(s.GeoJSON)));
 }
예제 #4
0
 public async void LoadSubdivsAndVolumes()
 {
     var service = new SubdivisionService();
     var subdivs = await service.SubdivisionsAndVolumes();
     Assert.That(subdivs.All(s => s.Id > 0));
     Assert.That(subdivs.All(s => s.Population.HasValue));
     Assert.That(subdivs.All(s => !string.IsNullOrWhiteSpace(s.GeoJSON)));
     foreach (var subdiv in subdivs)
     {
         Assert.That(subdiv.Volumes.Total, Is.GreaterThanOrEqualTo(0), $"subdiv {subdiv.Id} has total {subdiv.Volumes.Total}");
     }
 }
예제 #5
0
 public async void LoadAll()
 {
     var service = new SubdivisionService();
     var subdivs = await service.Density(AlcoholType.All, EndOfDistribution.Top, 1000);
     Assert.That(subdivs.All(s => s.Id > 0));
     Assert.That(subdivs.All(s => s.Population.HasValue));
     Assert.That(subdivs.All(s => string.IsNullOrWhiteSpace(s.GeoJSON)));
     Assert.That(subdivs.All(s => s.LcboStores.Count > 0));
     Assert.That(subdivs.All(s => s.CentreLatitude != 0.0));
     Assert.That(subdivs.All(s => s.CentreLongitude != 0.0));
     Assert.That(subdivs.All(s => s.OverallAlcoholDensity != 0.0));
     foreach (var subdiv in subdivs)
     {
         Assert.That(subdiv.Volumes.Total, Is.GreaterThan(0), $"subdiv {subdiv.Id} has total {subdiv.Volumes.Total}");
     }
 }
예제 #6
0
 public async void LoadTop10Densities()
 {
     var service = new SubdivisionService();
     var subdivs = await service.Top10AlcoholDensity();
     Assert.That(subdivs.Count, Is.EqualTo(10));
     Assert.That(subdivs.All(s => s.Id > 0));
     Assert.That(subdivs.All(s => s.Population.HasValue));
     Assert.That(subdivs.All(s => string.IsNullOrWhiteSpace(s.GeoJSON)));
     Assert.That(subdivs.All(s => s.LcboStores.Count > 0));
     Assert.That(subdivs.All(s => s.CentreLatitude != 0.0));
     Assert.That(subdivs.All(s => s.CentreLongitude != 0.0));
     foreach (var subdiv in subdivs)
     {
         Assert.That(subdiv.Volumes.Total, Is.GreaterThan(0), $"subdiv {subdiv.Id} has total {subdiv.Volumes.Total}");
     }
 }
예제 #7
0
 public async void GetBoundryGeoJson()
 {
     var service = new SubdivisionService();
     var boundary = await service.BoundaryGeoJson(1001113); // "Newfoundland and Labrador";"Trepassey"
     Assert.That(boundary, Is.Not.Null);
     Assert.That(boundary.Geometry.Type, Is.EqualTo(GeoJSON.Net.GeoJSONObjectType.Polygon));
 }