mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-04-22 09:26:39 +00:00
added stitching
This commit is contained in:
@@ -10,48 +10,11 @@ using Xunit;
|
||||
|
||||
namespace SatelliteProvider.Tests;
|
||||
|
||||
public class GoogleMapsDownloaderTests
|
||||
public class DummyTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task IntegrationTest_DownloadRealTiles_ShouldDownloadBytes()
|
||||
public async Task Dummy_ShouldWork()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
|
||||
var mapConfig = new MapConfig();
|
||||
configuration.GetSection("MapConfig").Bind(mapConfig);
|
||||
|
||||
var services = new ServiceCollection();
|
||||
services.AddHttpClient();
|
||||
services.AddLogging(builder => builder.AddConsole());
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
var logger = serviceProvider.GetRequiredService<ILogger<GoogleMapsDownloader>>();
|
||||
var options = Options.Create(mapConfig);
|
||||
var httpClientFactory = serviceProvider.GetRequiredService<IHttpClientFactory>();
|
||||
|
||||
var downloader = new GoogleMapsDownloader(logger, options, httpClientFactory);
|
||||
|
||||
var centerPoint = new GeoPoint(37.7749, -122.4194);
|
||||
var radius = 200.0;
|
||||
var zoomLevel = 15;
|
||||
|
||||
await downloader.GetTiles(centerPoint, radius, zoomLevel);
|
||||
|
||||
var mapsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "maps");
|
||||
Directory.Exists(mapsDirectory).Should().BeTrue();
|
||||
|
||||
var files = Directory.GetFiles(mapsDirectory, "*.jpg");
|
||||
files.Should().NotBeEmpty();
|
||||
|
||||
var totalBytes = files.Sum(file => new FileInfo(file).Length);
|
||||
totalBytes.Should().BeGreaterThan(0);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
Assert.Equal(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user