Files
Oleksandr Bezdieniezhnykh dea0b8b4c0 [AZ-286] [AZ-287] [AZ-288] Service-level unit tests (mocked deps)
Batch 2: 27 new tests, 31/31 total passing.

AZ-286 TileService (9 tests):
- BT-01 download stores tiles via repository
- BT-02 cache reuse passes existing tiles to downloader
- BT-02b stale-version cached tiles are NOT treated as still-valid
- BT-N02 GoogleMapsDownloaderV2 rejects zoom levels not in {15..19}
- GetTileAsync known/unknown id

AZ-287 RegionService (6 tests):
- AC-1 RequestRegionAsync inserts entity and queues request
- AC-2/AC-3 ProcessRegionAsync transitions queued→processing→completed
  and writes CSV + summary files
- AC-4 stitch path is set when stitchTiles=true
- ProcessRegionAsync handles RateLimitException by writing failed
  summary with the error message preserved
- GetRegionStatusAsync mapping
- Missing region id is logged and short-circuits without DB writes

AZ-288 RouteService (12 tests):
- AC-1 every consecutive pair is ≤200m apart on 2-point route
- AC-2 first/last user points keep their roles; middles are interpolated
- BT-10 10pt route → 1 start, 1 end, 8 action, plus intermediates
- BT-12 20pt route → 1 start, 1 end, 18 action
- AC-3 TotalDistanceMeters == Σ Haversine(point[i-1], point[i])
- BT-N03 < 2 points throws ArgumentException
- regionSize <100 / >10000 throws ArgumentException
- BT-N04 (0,0) corner throws
- BT-N05 inverted NW.lat <= SE.lat throws
- BT-11 valid geofence creates region requests + links them with
  isGeofence=true
- BT-07 GetRouteAsync returns route + points
- GetRouteAsync unknown id returns null

Code review: PASS_WITH_WARNINGS — 3 Low Spec-Gap findings:
  1. BT-N01 (invalid coords) deferred to AZ-289 integration tests
     (TileService doesn't validate coordinates — API-layer concern)
  2. Point-type label drift between blackbox-tests.md ("original")
     and code ("start"/"action"/"end")
  3. Region status drift: spec "pending" vs code "queued" — initial
     state on insert

Verification: docker dotnet test — 31/31 pass in 0.83s.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-10 05:02:00 +03:00

1.2 KiB

Unit Tests: RouteService

Task: AZ-288_route_service_tests Name: Unit tests: RouteService (interpolation, geofence, distance) Complexity: 3 points Dependencies: AZ-285 Component: Blackbox Tests Tracker: AZ-288 Epic: AZ-284

Scenarios

  • BT-06: Simple 2-point route — verify intermediate points at ≤200m spacing, point types correct
  • BT-07: Route retrieval — verify GET returns same route with all points
  • BT-10: Complex 10-point route — verify point distribution (1 first-original, 1 last-original, 8 intermediate)
  • BT-11: Geofenced route — verify geofence region creation
  • BT-12: Extended 20-point route — verify point distribution (1 first-original, 1 last-original, 18 intermediate)
  • BT-N03: Route with <2 points — verify validation error
  • BT-N04/N05: Invalid geofences — verify validation errors

Test Data

Route points from test_coordinates.md (ROUTE-01 through ROUTE-06)

Acceptance Criteria

AC-1: Point interpolation produces spacing ≤200m between all consecutive points AC-2: Point type assignment is correct (original/intermediate) AC-3: Total distance is calculated via Haversine AC-4: Negative cases return appropriate errors