public async Task GetImageInfosAsync_ReturnsImageMetaData() { var client = new MarsRoverApiClient(); var images = await client.GetImageInfosAsync(new DateTime(2019, 1, 1)); Assert.That(images.Length, Is.GreaterThan(0)); }
private static async Task DownloadImages(string datesFileName) { var imageRepository = new FileSystemImageRepository(AppConfiguration.ImageGalleryPath); var apiClient = new MarsRoverApiClient(); var nasaImageManager = new NasaImageManager(imageRepository, apiClient); nasaImageManager.ClearLocalImages(); await nasaImageManager.DownloadImagesAsync(new FileDateListProvider(datesFileName)).ConfigureAwait(false); }
public async Task DownloadImageAsync_DownloadsImages() { var client = new MarsRoverApiClient(); var images = await client.GetImageInfosAsync(new DateTime(2019, 1, 1)); var imageBytes = await client.DownloadImageAsync(images[0]); Assert.That(imageBytes.Length, Is.GreaterThan(0)); }
public async Task BenchmarkLoadingSequentially() { var marsRoverApiClient = new MarsRoverApiClient(); List <Task> tasks = new List <Task>(); foreach (var url in _urlList) { await marsRoverApiClient.DownloadImageAsync(new MarsImageInfo() { ImageLink = url }); } }
public void BenchmarkLoadingInParallel() { var marsRoverApiClient = new MarsRoverApiClient(); List <Task> tasks = new List <Task>(); foreach (var url in _urlList) { tasks.Add(marsRoverApiClient.DownloadImageAsync(new MarsImageInfo() { ImageLink = url })); } Task.WaitAll(tasks.ToArray()); }
public void DownloadImageAsync_WithNull_Throws() { var client = new MarsRoverApiClient(); Assert.ThrowsAsync <ArgumentNullException>(() => client.DownloadImageAsync(null)); }