Add test cases
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NetTopologySuite.Features;
|
||||
using NetTopologySuite.Geometries;
|
||||
@@ -45,14 +46,21 @@ public class ZoneDeterminatorService
|
||||
return Result.Success(zone.Attributes["zoneid"].ToString()!);
|
||||
}
|
||||
|
||||
private async Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken))
|
||||
public async Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
this.logger.LogTrace("Initializing...");
|
||||
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
|
||||
this.logger.LogTrace("Reading file...");
|
||||
string geojson = await File.ReadAllTextAsync(this.configuration.ZoneFilePath, cancellationToken);
|
||||
this.logger.LogTrace("File read in {Elapsed} ms", sw.ElapsedMilliseconds);
|
||||
|
||||
this.logger.LogTrace("Parsing geojson...");
|
||||
GeoJsonReader reader = new GeoJsonReader();
|
||||
this.parkingZones = reader.Read<FeatureCollection>(geojson);
|
||||
|
||||
this.logger.LogTrace("Geojson parsed in {Elapsed} ms: {FeatureCount} features", sw.ElapsedMilliseconds, this.parkingZones.Count);
|
||||
|
||||
this.initialized = true;
|
||||
this.logger.LogInformation("Initialized");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user