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
+62
@@ -0,0 +1,62 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeletedMusicAlbumDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeletedMusicAlbumDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DeletedMusicAlbumDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the deleted album.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the deleted album belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the deleted album belongs to.</param>
|
||||
/// <param name="artistName">Optional. The name of the artist the deleted album belongs to.</param>
|
||||
/// <param name="title">Optional. The title of the deleted album.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the album was deleted.</param>
|
||||
/// <param name="coverPath">Optional. The relative path of the stored cover image of the deleted album.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeletedMusicAlbumDto"/>.</returns>
|
||||
public DeletedMusicAlbumDto Create(
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
Guid? artistId = null,
|
||||
string? artistName = null,
|
||||
string? title = null,
|
||||
DateTime? deletedOnUtc = null,
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new DeletedMusicAlbumDto(
|
||||
Id: id ?? _faker.Random.Guid(),
|
||||
LibraryId: libraryId ?? _faker.Random.Guid(),
|
||||
ArtistId: artistId ?? _faker.Random.Guid(),
|
||||
ArtistName: artistName ?? _faker.Lorem.Word(),
|
||||
Title: title ?? _faker.Lorem.Sentence(),
|
||||
DeletedOnUtc: deletedOnUtc ?? _faker.Date.Recent(),
|
||||
CoverPath: includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="DeletedMusicAlbumDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeletedMusicAlbumDto"/> instances.</returns>
|
||||
public List<DeletedMusicAlbumDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeletedMusicArtistDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeletedMusicArtistDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DeletedMusicArtistDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the deleted artist.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the deleted artist belongs to.</param>
|
||||
/// <param name="name">Optional. The name of the deleted artist.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the artist was deleted.</param>
|
||||
/// <param name="coverPath">Optional. The relative path of the stored cover image of the deleted artist.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeletedMusicArtistDto"/>.</returns>
|
||||
public DeletedMusicArtistDto Create(
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
string? name = null,
|
||||
DateTime? deletedOnUtc = null,
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new DeletedMusicArtistDto(
|
||||
Id: id ?? _faker.Random.Guid(),
|
||||
LibraryId: libraryId ?? _faker.Random.Guid(),
|
||||
Name: name ?? _faker.Lorem.Word(),
|
||||
DeletedOnUtc: deletedOnUtc ?? _faker.Date.Recent(),
|
||||
CoverPath: includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="DeletedMusicArtistDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeletedMusicArtistDto"/> instances.</returns>
|
||||
public List<DeletedMusicArtistDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Libraries;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Libraries;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeletedMusicItemsPageDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeletedMusicItemsPageDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly LibraryDtoFixture _libraryDtoFixture = new();
|
||||
private readonly DeletedMusicArtistDtoFixture _deletedMusicArtistDtoFixture = new();
|
||||
private readonly DeletedMusicAlbumDtoFixture _deletedMusicAlbumDtoFixture = new();
|
||||
private readonly DeletedMusicTrackDtoFixture _deletedMusicTrackDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DeletedMusicItemsPageDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="library">Optional. The media library whose deleted music items are shown.</param>
|
||||
/// <param name="deletedArtists">Optional. The deleted artists of the media library.</param>
|
||||
/// <param name="deletedAlbums">Optional. The deleted albums of the media library.</param>
|
||||
/// <param name="deletedTracks">Optional. The deleted tracks of the media library.</param>
|
||||
/// <returns>The created <see cref="DeletedMusicItemsPageDto"/>.</returns>
|
||||
public DeletedMusicItemsPageDto Create(
|
||||
LibraryDto? library = null,
|
||||
IReadOnlyList<DeletedMusicArtistDto>? deletedArtists = null,
|
||||
IReadOnlyList<DeletedMusicAlbumDto>? deletedAlbums = null,
|
||||
IReadOnlyList<DeletedMusicTrackDto>? deletedTracks = null)
|
||||
{
|
||||
return new DeletedMusicItemsPageDto(
|
||||
Library: library ?? _libraryDtoFixture.Create(),
|
||||
DeletedArtists: deletedArtists ?? _deletedMusicArtistDtoFixture.CreateMany(_faker.Random.Number(1, 3)),
|
||||
DeletedAlbums: deletedAlbums ?? _deletedMusicAlbumDtoFixture.CreateMany(_faker.Random.Number(1, 3)),
|
||||
DeletedTracks: deletedTracks ?? _deletedMusicTrackDtoFixture.CreateMany(_faker.Random.Number(1, 3))
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="DeletedMusicItemsPageDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeletedMusicItemsPageDto"/> instances.</returns>
|
||||
public List<DeletedMusicItemsPageDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeletedMusicTrackDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeletedMusicTrackDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DeletedMusicTrackDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the deleted track.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the deleted track belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the deleted track belongs to.</param>
|
||||
/// <param name="artistName">Optional. The name of the artist the deleted track belongs to.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the deleted track belongs to.</param>
|
||||
/// <param name="albumTitle">Optional. The title of the album the deleted track belongs to.</param>
|
||||
/// <param name="title">Optional. The title of the deleted track.</param>
|
||||
/// <param name="path">Optional. The file system path of the deleted track.</param>
|
||||
/// <param name="deletedOnUtc">Optional. The date and time when the track was deleted.</param>
|
||||
/// <returns>The created <see cref="DeletedMusicTrackDto"/>.</returns>
|
||||
public DeletedMusicTrackDto Create(
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
Guid? artistId = null,
|
||||
string? artistName = null,
|
||||
Guid? albumId = null,
|
||||
string? albumTitle = null,
|
||||
string? title = null,
|
||||
string? path = null,
|
||||
DateTime? deletedOnUtc = null)
|
||||
{
|
||||
return new DeletedMusicTrackDto(
|
||||
Id: id ?? _faker.Random.Guid(),
|
||||
LibraryId: libraryId ?? _faker.Random.Guid(),
|
||||
ArtistId: artistId ?? _faker.Random.Guid(),
|
||||
ArtistName: artistName ?? _faker.Lorem.Word(),
|
||||
AlbumId: albumId ?? _faker.Random.Guid(),
|
||||
AlbumTitle: albumTitle ?? _faker.Lorem.Sentence(),
|
||||
Title: title ?? _faker.Lorem.Sentence(),
|
||||
Path: path ?? _faker.System.FilePath(),
|
||||
DeletedOnUtc: deletedOnUtc ?? _faker.Date.Recent()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="DeletedMusicTrackDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeletedMusicTrackDto"/> instances.</returns>
|
||||
public List<DeletedMusicTrackDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user