Adds deletion and restore for music library items.

This commit is contained in:
BinaryAlley committed 2026-11-15 18:53:10 +02:00
1 parent 98515dc5e8
commit f9ad8b2fc5
224 files changed
+22384 -1360

No files matched your search

@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.RestoreAlbum;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.RestoreAlbum;
/// <summary>
/// Fixture class for the <see cref="RestoreAlbumCommand"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RestoreAlbumCommandFixture
{
/// <summary>
/// Creates a random valid <see cref="RestoreAlbumCommand"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the album belongs to, taken from the route.</param>
/// <param name="artistId">Optional. The Id of the artist the album belongs to, taken from the route.</param>
/// <param name="albumId">Optional. The Id of the deleted album to restore, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="RestoreAlbumCommand"/>.</returns>
public RestoreAlbumCommand Create(
string? libraryId = null,
string? artistId = null,
string? albumId = null,
bool includeLibraryId = true,
bool includeArtistId = true,
bool includeAlbumId = true)
{
return new RestoreAlbumCommand(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="RestoreAlbumCommand"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="RestoreAlbumCommand"/> instances.</returns>
public List<RestoreAlbumCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Queries.GetDeletedAlbums;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Queries.GetDeletedAlbums;
/// <summary>
/// Fixture class for the <see cref="GetDeletedAlbumsQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDeletedAlbumsQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetDeletedAlbumsQuery"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose deleted albums are retrieved, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="GetDeletedAlbumsQuery"/>.</returns>
public GetDeletedAlbumsQuery Create(
string? libraryId = null,
bool includeLibraryId = true)
{
return new GetDeletedAlbumsQuery(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="GetDeletedAlbumsQuery"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="GetDeletedAlbumsQuery"/> instances.</returns>
public List<GetDeletedAlbumsQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,45 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.RestoreArtist;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.RestoreArtist;
/// <summary>
/// Fixture class for the <see cref="RestoreArtistCommand"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RestoreArtistCommandFixture
{
/// <summary>
/// Creates a random valid <see cref="RestoreArtistCommand"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
/// <param name="artistId">Optional. The Id of the deleted artist to restore, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="RestoreArtistCommand"/>.</returns>
public RestoreArtistCommand Create(
string? libraryId = null,
string? artistId = null,
bool includeLibraryId = true,
bool includeArtistId = true)
{
return new RestoreArtistCommand(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="RestoreArtistCommand"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="RestoreArtistCommand"/> instances.</returns>
public List<RestoreArtistCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetDeletedArtists;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetDeletedArtists;
/// <summary>
/// Fixture class for the <see cref="GetDeletedArtistsQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDeletedArtistsQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetDeletedArtistsQuery"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose deleted artists are retrieved, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="GetDeletedArtistsQuery"/>.</returns>
public GetDeletedArtistsQuery Create(
string? libraryId = null,
bool includeLibraryId = true)
{
return new GetDeletedArtistsQuery(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="GetDeletedArtistsQuery"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="GetDeletedArtistsQuery"/> instances.</returns>
public List<GetDeletedArtistsQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,55 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.RestoreTrack;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.RestoreTrack;
/// <summary>
/// Fixture class for the <see cref="RestoreTrackCommand"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class RestoreTrackCommandFixture
{
/// <summary>
/// Creates a random valid <see cref="RestoreTrackCommand"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the track belongs to, taken from the route.</param>
/// <param name="artistId">Optional. The Id of the artist the album of the track belongs to, taken from the route.</param>
/// <param name="albumId">Optional. The Id of the album the track belongs to, taken from the route.</param>
/// <param name="trackId">Optional. The Id of the deleted track to restore, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTrackId">Whether the track Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="RestoreTrackCommand"/>.</returns>
public RestoreTrackCommand Create(
string? libraryId = null,
string? artistId = null,
string? albumId = null,
string? trackId = null,
bool includeLibraryId = true,
bool includeArtistId = true,
bool includeAlbumId = true,
bool includeTrackId = true)
{
return new RestoreTrackCommand(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null,
includeTrackId ? (trackId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="RestoreTrackCommand"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="RestoreTrackCommand"/> instances.</returns>
public List<RestoreTrackCommand> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetDeletedTracks;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetDeletedTracks;
/// <summary>
/// Fixture class for the <see cref="GetDeletedTracksQuery"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDeletedTracksQueryFixture
{
/// <summary>
/// Creates a random valid <see cref="GetDeletedTracksQuery"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library whose deleted tracks are retrieved, taken from the route.</param>
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="GetDeletedTracksQuery"/>.</returns>
public GetDeletedTracksQuery Create(
string? libraryId = null,
bool includeLibraryId = true)
{
return new GetDeletedTracksQuery(
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null);
}
/// <summary>
/// Creates a list of <see cref="GetDeletedTracksQuery"/>.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="GetDeletedTracksQuery"/> instances.</returns>
public List<GetDeletedTracksQuery> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}