Add test cases
All checks were successful
Build, Push and Run Container / build (push) Successful in 27s

This commit is contained in:
2025-08-21 17:23:52 +02:00
parent 00e79097d6
commit b00cebbd0a
4 changed files with 51 additions and 13 deletions

View File

@@ -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");
}
}