mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Adds deletion and restore for music library items.
This commit is contained in:
1 parent
98515dc5e8
commit
f9ad8b2fc5
224 files changed
+22384
-1360
No files matched your search
+9
-1
@@ -55,10 +55,12 @@ public class AlbumEntityFixture
|
||||
/// <param name="releaseStatus">Optional. The release status of the album.</param>
|
||||
/// <param name="totalDiscs">Optional. The total number of discs of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The media format of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="catalogNumbers">Optional. The catalog numbers of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz release identifier of the album.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz release group identifier of the album.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz release artist identifier of the album.</param>
|
||||
/// <param name="isDeleted">Whether the album is soft deleted.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the album was deleted.</param>
|
||||
/// <param name="includeTracks">Whether the album should own a generated track, or no track at all.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections (Tags, Genres, Contributors, Ratings) should be included, or forced to empty collections.</param>
|
||||
/// <param name="includeOriginalReleaseDate">Whether the original release date should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -78,6 +80,7 @@ public class AlbumEntityFixture
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeletedOnUtc">Whether a deleted album should carry a deletion time, or <see langword="null"/>.</param>
|
||||
/// <param name="metadataStatus">Optional. The metadata enrichment status of the album.</param>
|
||||
/// <returns>The created <see cref="AlbumEntity"/>.</returns>
|
||||
public AlbumEntity Create(
|
||||
@@ -107,6 +110,8 @@ public class AlbumEntityFixture
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
bool isDeleted = false,
|
||||
DateTime? deletedOnUtc = null,
|
||||
bool includeTracks = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeOriginalReleaseDate = true,
|
||||
@@ -126,6 +131,7 @@ public class AlbumEntityFixture
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
bool includeDeletedOnUtc = true,
|
||||
MetadataStatus? metadataStatus = null)
|
||||
{
|
||||
Guid resolvedId = id ?? Guid.NewGuid();
|
||||
@@ -182,6 +188,8 @@ public class AlbumEntityFixture
|
||||
.RuleFor(x => x.Contributors, f => includeMetadata ? _albumContributorEntityFixture.CreateMany(f.Random.Number(1, 3), albumId: resolvedId) : [])
|
||||
.RuleFor(x => x.Ratings, f => includeMetadata ? _audioRatingEntityFixture.CreateMany(f.Random.Number(1, 3)) : [])
|
||||
.RuleFor(x => x.Tracks, resolvedTracks)
|
||||
.RuleFor(x => x.IsDeleted, isDeleted)
|
||||
.RuleFor(x => x.DeletedOnUtc, f => isDeleted && includeDeletedOnUtc ? (deletedOnUtc ?? f.Date.Recent()) : null)
|
||||
.RuleFor(x => x.CreatedOnUtc, f => f.Date.Past())
|
||||
.RuleFor(x => x.UpdatedOnUtc, f => f.Date.Recent())
|
||||
.Generate();
|
||||
|
||||
+9
-1
@@ -27,11 +27,14 @@ public class ArtistEntityFixture
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist.</param>
|
||||
/// <param name="isDeleted">Whether the artist is soft deleted.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the artist was deleted.</param>
|
||||
/// <param name="includeAlbums">Whether the artist should own a generated album, or no album at all.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the artist should own a generated media contributor, or none at all.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections of the generated album should be included, or forced to empty collections.</param>
|
||||
/// <param name="includeDeletedOnUtc">Whether a deleted artist should carry a deletion time, or <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ArtistEntity"/>.</returns>
|
||||
public ArtistEntity Create(
|
||||
Guid? id = null,
|
||||
@@ -40,11 +43,14 @@ public class ArtistEntityFixture
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<AlbumEntity>? albums = null,
|
||||
bool isDeleted = false,
|
||||
DateTime? deletedOnUtc = null,
|
||||
bool includeAlbums = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeContributors = true,
|
||||
bool includeMetadata = true)
|
||||
bool includeMetadata = true,
|
||||
bool includeDeletedOnUtc = true)
|
||||
{
|
||||
Guid resolvedId = id ?? Guid.NewGuid();
|
||||
Guid resolvedLibraryId = libraryId ?? Guid.NewGuid();
|
||||
@@ -65,6 +71,8 @@ public class ArtistEntityFixture
|
||||
.RuleFor(x => x.MusicBrainzArtistId, f => includeMusicBrainzArtistId ? (musicBrainzArtistId ?? f.Random.Guid()) : null)
|
||||
.RuleFor(x => x.Albums, resolvedAlbums)
|
||||
.RuleFor(x => x.Contributors, f => includeContributors ? _artistContributorEntityFixture.CreateMany(f.Random.Number(1, 3), artistId: resolvedId) : [])
|
||||
.RuleFor(x => x.IsDeleted, isDeleted)
|
||||
.RuleFor(x => x.DeletedOnUtc, f => isDeleted && includeDeletedOnUtc ? (deletedOnUtc ?? f.Date.Recent()) : null)
|
||||
.RuleFor(x => x.CreatedOnUtc, f => f.Date.Past())
|
||||
.RuleFor(x => x.UpdatedOnUtc, f => f.Date.Recent())
|
||||
.Generate();
|
||||
|
||||
+9
-1
@@ -44,6 +44,8 @@ public class TrackEntityFixture
|
||||
/// <param name="originalReleaseYear">Optional. The original release year of the track.</param>
|
||||
/// <param name="reReleaseDate">Optional. The re-release date of the track.</param>
|
||||
/// <param name="reReleaseYear">Optional. The re-release year of the track.</param>
|
||||
/// <param name="isDeleted">Whether the track is soft deleted.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the track was deleted.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections (Tags, Genres, Moods, ISRCs, Contributors, Ratings) should be included, or forced to empty collections.</param>
|
||||
/// <param name="includeOriginalReleaseDate">Whether the original release date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeOriginalReleaseYear">Whether the original release year should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -58,6 +60,7 @@ public class TrackEntityFixture
|
||||
/// <param name="replayGainAlbumGain">Optional. The ReplayGain album gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainAlbumPeak">Optional. The ReplayGain album peak of the track.</param>
|
||||
/// <param name="includeReplayGain">Whether the ReplayGain values should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeletedOnUtc">Whether a deleted track should carry a deletion time, or <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="TrackEntity"/>.</returns>
|
||||
public TrackEntity Create(
|
||||
Guid? id = null,
|
||||
@@ -72,6 +75,8 @@ public class TrackEntityFixture
|
||||
int? originalReleaseYear = null,
|
||||
DateOnly? reReleaseDate = null,
|
||||
int? reReleaseYear = null,
|
||||
bool isDeleted = false,
|
||||
DateTime? deletedOnUtc = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeOriginalReleaseDate = true,
|
||||
bool includeOriginalReleaseYear = true,
|
||||
@@ -85,7 +90,8 @@ public class TrackEntityFixture
|
||||
decimal? replayGainTrackPeak = null,
|
||||
decimal? replayGainAlbumGain = null,
|
||||
decimal? replayGainAlbumPeak = null,
|
||||
bool includeReplayGain = true)
|
||||
bool includeReplayGain = true,
|
||||
bool includeDeletedOnUtc = true)
|
||||
{
|
||||
Guid resolvedId = id ?? Guid.NewGuid();
|
||||
Guid resolvedAlbumId = albumId ?? Guid.NewGuid();
|
||||
@@ -154,6 +160,8 @@ public class TrackEntityFixture
|
||||
.RuleFor(x => x.Isrcs, f => includeMetadata ? _trackIsrcEntityFixture.CreateMany(f.Random.Number(1, 3)) : [])
|
||||
.RuleFor(x => x.Contributors, f => includeMetadata ? _trackContributorEntityFixture.CreateMany(f.Random.Number(1, 3), trackId: resolvedId) : [])
|
||||
.RuleFor(x => x.Ratings, f => includeMetadata ? _audioRatingEntityFixture.CreateMany(f.Random.Number(1, 3)) : [])
|
||||
.RuleFor(x => x.IsDeleted, isDeleted)
|
||||
.RuleFor(x => x.DeletedOnUtc, f => isDeleted && includeDeletedOnUtc ? (deletedOnUtc ?? f.Date.Recent()) : null)
|
||||
.RuleFor(x => x.CreatedOnUtc, f => f.Date.Past())
|
||||
.RuleFor(x => x.UpdatedOnUtc, f => f.Date.Recent())
|
||||
.Generate();
|
||||
|
||||
+50
@@ -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())];
|
||||
}
|
||||
}
|
||||
+40
@@ -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())];
|
||||
}
|
||||
}
|
||||
+45
@@ -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())];
|
||||
}
|
||||
}
|
||||
+40
@@ -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())];
|
||||
}
|
||||
}
|
||||
+55
@@ -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())];
|
||||
}
|
||||
}
|
||||
+40
@@ -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())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user