mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 20:11:17 +00:00
8b0ddae075
Phase B of architecture coupling refactor (epic AZ-309). Replaces the monolithic SatelliteProvider.Services with three per-component csprojs to add a compiler-enforced module boundary (resolves F4): - SatelliteProvider.Services.TileDownloader - SatelliteProvider.Services.RegionProcessing - SatelliteProvider.Services.RouteManagement DI registrations relocated into per-component AddTileDownloader / AddRegionProcessing / AddRouteManagement extension methods called from Program.cs. RateLimitException moved to Common/Exceptions/ to keep the three new csprojs as siblings (no Region->TileDownloader ProjectReference). Dockerfiles and consumer csprojs (Api, Tests) rewired to the new project paths. No DI lifetime or hosted-service order changes. Build: 0 warn, 0 err. Unit tests: 40/40. Smoke integration: green. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
using FluentAssertions;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Moq;
|
|
using SatelliteProvider.Common.DTO;
|
|
using SatelliteProvider.Common.Interfaces;
|
|
using SatelliteProvider.DataAccess.Models;
|
|
using SatelliteProvider.DataAccess.Repositories;
|
|
using SatelliteProvider.Services.TileDownloader;
|
|
using SatelliteProvider.Tests.Fixtures;
|
|
|
|
namespace SatelliteProvider.Tests;
|
|
|
|
public class InfrastructureTests
|
|
{
|
|
[Fact]
|
|
public void AllMockableInterfaces_CanBeMocked()
|
|
{
|
|
// Arrange + Act
|
|
var downloader = new Mock<ISatelliteDownloader>();
|
|
var tileRepo = new Mock<ITileRepository>();
|
|
var regionRepo = new Mock<IRegionRepository>();
|
|
var routeRepo = new Mock<IRouteRepository>();
|
|
var queue = new Mock<IRegionRequestQueue>();
|
|
var tileService = new Mock<ITileService>();
|
|
var regionService = new Mock<IRegionService>();
|
|
var routeService = new Mock<IRouteService>();
|
|
|
|
// Assert
|
|
downloader.Object.Should().NotBeNull();
|
|
tileRepo.Object.Should().NotBeNull();
|
|
regionRepo.Object.Should().NotBeNull();
|
|
routeRepo.Object.Should().NotBeNull();
|
|
queue.Object.Should().NotBeNull();
|
|
tileService.Object.Should().NotBeNull();
|
|
regionService.Object.Should().NotBeNull();
|
|
routeService.Object.Should().NotBeNull();
|
|
}
|
|
|
|
[Fact]
|
|
public void TestCoordinates_TileCenter_MatchesPrimaryTilePoint()
|
|
{
|
|
// Assert
|
|
TestCoordinates.TileCenter.Lat.Should().Be(47.461747);
|
|
TestCoordinates.TileCenter.Lon.Should().Be(37.647063);
|
|
TestCoordinates.DefaultZoom.Should().Be(18);
|
|
}
|
|
|
|
[Fact]
|
|
public void TestCoordinates_RoutePoints_HaveExpectedCounts()
|
|
{
|
|
// Assert
|
|
TestCoordinates.Route.Route01Points.Should().HaveCount(2);
|
|
TestCoordinates.Route.Route04Points.Should().HaveCount(10);
|
|
TestCoordinates.Route.Route06Points.Should().HaveCount(20);
|
|
}
|
|
|
|
[Fact]
|
|
public void TileService_ConstructsWithMockedDependencies()
|
|
{
|
|
// Arrange
|
|
var downloader = new Mock<ISatelliteDownloader>().Object;
|
|
var tileRepo = new Mock<ITileRepository>().Object;
|
|
var cache = new MemoryCache(new MemoryCacheOptions());
|
|
var logger = NullLogger<TileService>.Instance;
|
|
|
|
// Act
|
|
var service = new TileService(downloader, tileRepo, cache, logger);
|
|
|
|
// Assert
|
|
service.Should().NotBeNull();
|
|
}
|
|
}
|