Files
satellite-provider/SatelliteProvider.Tests/ConfigDefaultsTests.cs
T
Oleksandr Bezdieniezhnykh 1dcd089d39 [AZ-371] Refactor C18: magic numbers to ProcessingConfig/MapConfig
Promotes 8 operational levers into config keys with defaults that match
the prior source literals byte-for-byte:
  ProcessingConfig: RegionProcessingTimeoutSeconds (300),
  RouteProcessingPollIntervalSeconds (5),
  MaxRoutePointSpacingMeters (200), LatLonTolerance (0.0001).
  MapConfig: TileSizePixels (256), AllowedZoomLevels ([15..19]),
  RetryBaseDelaySeconds (1), RetryMaxDelaySeconds (30).

Sites updated: RegionService, RouteProcessingService,
RoutePointGraphBuilder, RouteValidator, RouteService 4-arg ctor,
RouteImageRenderer, GoogleMapsDownloaderV2, TileService. Closes LF-2 by
forwarding HttpContext.RequestAborted from GetTileByLatLon into the
downloader. appsettings.json gains the 8 new keys at default values.

Tests: 141 / 141 unit + 5 / 5 smoke green. New ConfigDefaultsTests pins
defaults to original literals; new TileService unit test asserts CT
identity from caller to downloader (AZ-371 AC-3).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 03:30:07 +03:00

63 lines
2.0 KiB
C#

using FluentAssertions;
using SatelliteProvider.Common.Configs;
namespace SatelliteProvider.Tests;
// AZ-371 / C18 — verifies the config defaults preserve the original literal values
// that lived in source code prior to the magic-numbers-to-config refactor.
public class ConfigDefaultsTests
{
[Fact]
public void ProcessingConfig_RegionProcessingTimeout_PreservesOriginal_AZ371_AC2()
{
// Assert
new ProcessingConfig().RegionProcessingTimeoutSeconds.Should().Be(300, "RegionService used TimeSpan.FromMinutes(5) before AZ-371");
}
[Fact]
public void ProcessingConfig_RouteProcessingPollInterval_PreservesOriginal_AZ371_AC2()
{
// Assert
new ProcessingConfig().RouteProcessingPollIntervalSeconds.Should().Be(5, "RouteProcessingService polled every 5s before AZ-371");
}
[Fact]
public void ProcessingConfig_MaxRoutePointSpacingMeters_PreservesOriginal_AZ371_AC2()
{
// Assert
new ProcessingConfig().MaxRoutePointSpacingMeters.Should().Be(200.0, "RoutePointGraphBuilder used 200m spacing before AZ-371");
}
[Fact]
public void ProcessingConfig_LatLonTolerance_PreservesOriginal_AZ371_AC2()
{
// Assert
new ProcessingConfig().LatLonTolerance.Should().Be(0.0001, "RouteValidator and GoogleMapsDownloaderV2 used 0.0001 before AZ-371");
}
[Fact]
public void MapConfig_TileSizePixels_PreservesOriginal_AZ371_AC2()
{
// Assert
new MapConfig().TileSizePixels.Should().Be(256, "TileService and GoogleMapsDownloaderV2 used 256 px before AZ-371");
}
[Fact]
public void MapConfig_AllowedZoomLevels_PreservesOriginal_AZ371_AC2()
{
// Assert
new MapConfig().AllowedZoomLevels.Should().Equal(15, 16, 17, 18, 19);
}
[Fact]
public void MapConfig_RetryDelays_PreserveOriginal_AZ371_AC2()
{
// Arrange
var cfg = new MapConfig();
// Assert
cfg.RetryBaseDelaySeconds.Should().Be(1);
cfg.RetryMaxDelaySeconds.Should().Be(30);
}
}