Files
satellite-provider/SatelliteProvider.Tests/InfrastructureTests.cs
T
Oleksandr Bezdieniezhnykh 853b0a63df [AZ-285] Test infrastructure: scaffold unit test project + fixtures
- Add SatelliteProvider.DataAccess project reference to test csproj
  (enables mocking ITileRepository / IRegionRepository / IRouteRepository)
- Replace DummyTest placeholder with InfrastructureTests covering:
  * All mockable interfaces (ISatelliteDownloader, repos, queue, services)
    can be mocked via Moq
  * TileService can be constructed with mocked dependencies
  * Test coordinate fixtures load with expected values
- Add Fixtures/TestCoordinates.cs with REG-01..REG-03 + ROUTE-01/04/06
  shared test data
- Archive AZ-285 to _docs/02_tasks/done/
- Batch 1 review report: PASS_WITH_WARNINGS (Low/Spec-Gap deferred AC-2,
  Low/Maintainability pre-existing FluentAssertions 8.x license note)

Verification: docker dotnet test run — 4/4 tests pass in 2.35s.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-10 04:55:28 +03:00

72 lines
2.3 KiB
C#

using FluentAssertions;
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;
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 logger = NullLogger<TileService>.Instance;
// Act
var service = new TileService(downloader, tileRepo, logger);
// Assert
service.Should().NotBeNull();
}
}