mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
feat: add download mode option (Track/Album) for Deezer downloads
Closes #10
This commit is contained in:
@@ -53,7 +53,7 @@ public class DeezerDownloadServiceTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private DeezerDownloadService CreateService(string? arl = null)
|
||||
private DeezerDownloadService CreateService(string? arl = null, DownloadMode downloadMode = DownloadMode.Track)
|
||||
{
|
||||
var config = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
@@ -64,11 +64,17 @@ public class DeezerDownloadServiceTests : IDisposable
|
||||
})
|
||||
.Build();
|
||||
|
||||
var subsonicSettings = Options.Create(new SubsonicSettings
|
||||
{
|
||||
DownloadMode = downloadMode
|
||||
});
|
||||
|
||||
return new DeezerDownloadService(
|
||||
_httpClientFactoryMock.Object,
|
||||
config,
|
||||
_localLibraryServiceMock.Object,
|
||||
_metadataServiceMock.Object,
|
||||
subsonicSettings,
|
||||
_loggerMock.Object);
|
||||
}
|
||||
|
||||
@@ -162,6 +168,42 @@ public class DeezerDownloadServiceTests : IDisposable
|
||||
|
||||
Assert.Equal("Song not found", exception.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DownloadRemainingAlbumTracksInBackground_WithUnsupportedProvider_DoesNotThrow()
|
||||
{
|
||||
// Arrange
|
||||
var service = CreateService(arl: "test-arl", downloadMode: DownloadMode.Album);
|
||||
|
||||
// Act & Assert - Should not throw, just log warning
|
||||
service.DownloadRemainingAlbumTracksInBackground("spotify", "123456", "789");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DownloadRemainingAlbumTracksInBackground_WithDeezerProvider_StartsBackgroundTask()
|
||||
{
|
||||
// Arrange
|
||||
_metadataServiceMock
|
||||
.Setup(s => s.GetAlbumAsync("deezer", "123456"))
|
||||
.ReturnsAsync(new Album
|
||||
{
|
||||
Id = "ext-deezer-album-123456",
|
||||
Title = "Test Album",
|
||||
Songs = new List<Song>
|
||||
{
|
||||
new Song { ExternalId = "111", Title = "Track 1" },
|
||||
new Song { ExternalId = "222", Title = "Track 2" }
|
||||
}
|
||||
});
|
||||
|
||||
var service = CreateService(arl: "test-arl", downloadMode: DownloadMode.Album);
|
||||
|
||||
// Act - Should not throw (fire-and-forget)
|
||||
service.DownloadRemainingAlbumTracksInBackground("deezer", "123456", "111");
|
||||
|
||||
// Assert - Just verify it doesn't throw, actual download is async
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user