mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Adds the music library commands and their validators
This commit is contained in:
1 parent
b7db29eee5
commit
1fad9316ce
30 files changed
+700
-256
No files matched your search
+22
-7
@@ -25,7 +25,7 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddAlbumCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly AddTrackCommandFixture _addTrackCommandFixture = new();
|
||||
@@ -37,8 +37,11 @@ public class AddAlbumCommandFixture
|
||||
/// <param name="artistId">Optional. The Id of the artist the album belongs to, taken from the route.</param>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
@@ -50,8 +53,11 @@ public class AddAlbumCommandFixture
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -63,10 +69,13 @@ public class AddAlbumCommandFixture
|
||||
public AddAlbumCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
AlbumMetadataDto? metadata = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
string? catalogNumber = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
@@ -78,8 +87,11 @@ public class AddAlbumCommandFixture
|
||||
bool includeArtistId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumber = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
@@ -94,10 +106,13 @@ public class AddAlbumCommandFixture
|
||||
return new AddAlbumCommand(
|
||||
resolvedLibraryId,
|
||||
resolvedArtistId,
|
||||
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(_faker.Random.Int(12, 13), "0123456789")) : null,
|
||||
includeCatalogNumber ? (catalogNumber ?? _faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
|
||||
+22
-7
@@ -23,7 +23,7 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateAlbumCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
@@ -35,8 +35,11 @@ public class UpdateAlbumCommandFixture
|
||||
/// <param name="albumId">Optional. The Id of the album to update, taken from the route.</param>
|
||||
/// <param name="metadata">Optional. The album metadata of the album.</param>
|
||||
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
|
||||
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the album.</param>
|
||||
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
|
||||
/// <param name="label">Optional. The name of the label that issued the album.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the album.</param>
|
||||
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
|
||||
@@ -47,8 +50,11 @@ public class UpdateAlbumCommandFixture
|
||||
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -59,10 +65,13 @@ public class UpdateAlbumCommandFixture
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
AlbumMetadataDto? metadata = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
string? catalogNumber = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
@@ -73,8 +82,11 @@ public class UpdateAlbumCommandFixture
|
||||
bool includeAlbumId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumber = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
@@ -85,10 +97,13 @@ public class UpdateAlbumCommandFixture
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
includeBarcode ? (barcode ?? _faker.Random.String2(_faker.Random.Int(12, 13), "0123456789")) : null,
|
||||
includeCatalogNumber ? (catalogNumber ?? _faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))) : null,
|
||||
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(_faker.Random.Int(1, 50))]) : null,
|
||||
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
|
||||
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
|
||||
+26
-5
@@ -4,7 +4,11 @@ using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Comm
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.AddArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -20,47 +24,64 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to add an artist.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</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="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to add an artist.</returns>
|
||||
public AddArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? name = null,
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeName = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
|
||||
return new AddArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
|
||||
+26
-5
@@ -4,7 +4,11 @@ using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Comm
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -20,41 +24,55 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update an artist.
|
||||
/// </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 artist, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="metadata">Optional. The metadata of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</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="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</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="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to update an artist.</returns>
|
||||
public UpdateArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? name = null,
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includeName = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
@@ -62,10 +80,13 @@ public class UpdateArtistCommandFixture
|
||||
return new UpdateArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
|
||||
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
|
||||
+7
-11
@@ -26,7 +26,8 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class AddTrackCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
@@ -45,10 +46,9 @@ public class AddTrackCommandFixture
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The title of the work the track is a recording of.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="moods">Optional. The list of moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The list of ISRC of the track.</param>
|
||||
/// <param name="contributors">Optional. The list of media contributors that performed on the track.</param>
|
||||
@@ -67,7 +67,6 @@ public class AddTrackCommandFixture
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -78,16 +77,15 @@ public class AddTrackCommandFixture
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
string? path = null,
|
||||
AudioMetadataDto? metadata = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
string? work = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
Guid? musicBrainzWorkId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
@@ -106,7 +104,6 @@ public class AddTrackCommandFixture
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
@@ -117,16 +114,15 @@ public class AddTrackCommandFixture
|
||||
includeArtistId ? artistId ?? Guid.NewGuid().ToString() : null,
|
||||
includeAlbumId ? albumId ?? Guid.NewGuid().ToString() : null,
|
||||
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
|
||||
includeMetadata ? metadata ?? _audioMetadataDtoFixture.Create() : null,
|
||||
includeMetadata ? metadata ?? _musicTrackMetadataDtoFixture.Create() : null,
|
||||
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
|
||||
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
|
||||
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
|
||||
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
|
||||
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
|
||||
includeWork ? work ?? _faker.Lorem.Sentence() : null,
|
||||
includeWork ? work ?? _musicWorkDtoFixture.Create() : null,
|
||||
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
|
||||
includeMusicBrainzWorkId ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
|
||||
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
|
||||
|
||||
+7
-11
@@ -25,7 +25,8 @@ namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrar
|
||||
public class UpdateTrackCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
|
||||
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
|
||||
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
|
||||
private readonly MoodDtoFixture _moodDtoFixture = new();
|
||||
private readonly IsrcDtoFixture _isrcDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
@@ -45,10 +46,9 @@ public class UpdateTrackCommandFixture
|
||||
/// <param name="script">Optional. The script used by the language of the track.</param>
|
||||
/// <param name="key">Optional. The musical key of the track.</param>
|
||||
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
|
||||
/// <param name="work">Optional. The title of the work the track is a recording of.</param>
|
||||
/// <param name="work">Optional. The work the track is a recording of.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
|
||||
@@ -60,7 +60,6 @@ public class UpdateTrackCommandFixture
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -79,16 +78,15 @@ public class UpdateTrackCommandFixture
|
||||
string? albumId = null,
|
||||
string? trackId = null,
|
||||
string? path = null,
|
||||
AudioMetadataDto? metadata = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
string? work = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
Guid? musicBrainzWorkId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
@@ -100,7 +98,6 @@ public class UpdateTrackCommandFixture
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMusicBrainzWorkId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeMetadata = true,
|
||||
@@ -119,16 +116,15 @@ public class UpdateTrackCommandFixture
|
||||
includeAlbumId ? (albumId ?? _faker.Random.Guid().ToString()) : null,
|
||||
includeTrackId ? (trackId ?? _faker.Random.Guid().ToString()) : null,
|
||||
includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
|
||||
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
|
||||
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
|
||||
includeWork ? (work ?? _faker.Music.Genre()) : null,
|
||||
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
|
||||
Reference in new issue
Block a user