Adds the music metadata data transfer objects, their requests and responses, and extends the artwork data transfer object

This commit is contained in:
BinaryAlley committed 2026-10-06 20:38:00 +03:00
1 parent 5529e99024
commit a939d8fd5f
48 files changed
+1961 -161

No files matched your search

@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -18,12 +19,16 @@ public class ArtworkDtoFixture
/// </summary>
/// <param name="localPath">Optional. The local file system path of the artwork.</param>
/// <param name="remoteUrl">Optional. The remote URL of the artwork.</param>
/// <param name="type">Optional. The type of the artwork.</param>
/// <param name="ordinal">Optional. The ordinal of the artwork within its type.</param>
/// <returns>The created <see cref="ArtworkDto"/>.</returns>
public ArtworkDto Create(
string? localPath = null,
string? remoteUrl = null)
string? remoteUrl = null,
ArtworkType type = ArtworkType.Cover,
int ordinal = 0)
{
return new ArtworkDto(localPath, remoteUrl);
return new ArtworkDto(type, ordinal, localPath, remoteUrl);
}
/// <summary>
@@ -1,8 +1,12 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
@@ -27,74 +31,145 @@ public class AlbumMetadataDtoFixture
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="AlbumMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="originalTitle">Optional. The original title of the album.</param>
/// <param name="releaseTitle">Optional. The title of the specific release (edition) of the album.</param>
/// <param name="description">Optional. A brief description or summary of the album.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the album.</param>
/// <param name="releaseInfo">Optional. The release information of the album.</param>
/// <param name="language">Optional. The language of the album.</param>
/// <param name="originalLanguage">Optional. The original language of the album.</param>
/// <param name="tags">Optional. The tags that describe or categorize the album.</param>
/// <param name="genres">Optional. The genres associated with the album.</param>
/// <param name="releaseType">Optional. The type of the release.</param>
/// <param name="script">Optional. The script used by the language of the release of the album.</param>
/// <param name="releaseTypes">Optional. The types of the release.</param>
/// <param name="releaseStatus">Optional. The status of the release.</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="totalDiscs">Optional. The number of discs of the release.</param>
/// <param name="totalTracks">Optional. The number of tracks of the release.</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>
/// <param name="contributors">Optional. The media contributors that performed on the album.</param>
/// <param name="ratings">Optional. The ratings of the album.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseType">Whether the release type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseTypes">Whether the release types should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseStatus">Whether the release status 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="includeTotalDiscs">Whether the total number of discs should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalTracks">Whether the total number of tracks 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="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>
/// <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>
/// <returns>The created <see cref="AlbumMetadataDto"/>.</returns>
public AlbumMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? releaseTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
MusicReleaseType? releaseType = null,
string? script = null,
List<MusicReleaseType>? releaseTypes = null,
MusicReleaseStatus? releaseStatus = null,
MusicMediaFormat? mediaFormat = null,
MusicReleasePackaging? packaging = null,
int? totalDiscs = null,
int? totalTracks = null,
string? barcode = null,
List<string>? catalogNumbers = null,
string? label = null,
string? asin = null,
Guid? musicBrainzReleaseId = null,
Guid? musicBrainzReleaseGroupId = null,
Guid? musicBrainzReleaseArtistId = null,
List<MediaContributorDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeReleaseType = true,
bool includeScript = true,
bool includeReleaseTypes = true,
bool includeReleaseStatus = true,
bool includeMediaFormat = true,
bool includePackaging = true,
bool includeTotalDiscs = true,
bool includeTotalTracks = true)
bool includeTotalTracks = true,
bool includeBarcode = true,
bool includeCatalogNumbers = true,
bool includeLabel = true,
bool includeAsin = true,
bool includeMusicBrainzReleaseId = true,
bool includeMusicBrainzReleaseGroupId = true,
bool includeMusicBrainzReleaseArtistId = true,
bool includeContributors = true,
bool includeRatings = true,
bool includeReleaseTitle = true)
{
return new AlbumMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeReleaseType ? (releaseType ?? _faker.PickRandom<MusicReleaseType>()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeReleaseTypes ? (releaseTypes ?? [_faker.PickRandom<MusicReleaseType>()]) : null,
includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom<MusicReleaseStatus>()) : null,
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
includeTotalDiscs ? (totalDiscs ?? _faker.Random.Int(1, 3)) : null,
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null);
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null,
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(10)]) : 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,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeReleaseTitle ? (releaseTitle ?? _faker.Commerce.ProductName()) : null);
}
/// <summary>
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="AlbumMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class AlbumMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="AlbumMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the album belongs to.</param>
/// <param name="path">Optional. The file system path of a track of the album.</param>
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group of the album.</param>
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release of the album.</param>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="artistName">Optional. The name of the artist of the album.</param>
/// <param name="releaseYear">Optional. The year the album was released.</param>
/// <param name="trackCount">Optional. The number of tracks the local album has.</param>
/// <returns>The created <see cref="AlbumMetadataLookupDto"/>.</returns>
public AlbumMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzReleaseGroupId = null,
Guid? musicBrainzReleaseId = null,
string? title = null,
string? artistName = null,
int? releaseYear = null,
int? trackCount = null)
{
return new AlbumMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzReleaseGroupId,
musicBrainzReleaseId,
title,
artistName,
releaseYear,
trackCount);
}
/// <summary>
/// Creates a list of <see cref="AlbumMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<AlbumMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,159 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="ArtistMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ArtistMetadataDtoFixture
{
private const int MINIMUM_LIFESPAN_YEAR = 1900;
private const int MAXIMUM_LIFESPAN_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new();
private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="ArtistMetadataDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="sortName">Optional. The sort name of the artist.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the artist.</param>
/// <param name="type">Optional. The type of the artist.</param>
/// <param name="gender">Optional. The gender of the artist.</param>
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">Optional. The area the artist is primarily identified with.</param>
/// <param name="beginArea">Optional. The area the artist began in.</param>
/// <param name="endArea">Optional. The area the artist ended in.</param>
/// <param name="lifeSpanBegin">Optional. The date the artist started existing.</param>
/// <param name="lifeSpanEnd">Optional. The date the artist stopped existing.</param>
/// <param name="isEnded">Optional. Whether the artist no longer exists.</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="aliases">Optional. The alternative names of the artist.</param>
/// <param name="genres">Optional. The genres associated with the artist.</param>
/// <param name="tags">Optional. The tags that describe or categorize the artist.</param>
/// <param name="ratings">Optional. The ratings of the artist.</param>
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGender">Whether the gender should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginArea">Whether the begin area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndArea">Whether the end area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanBegin">Whether the lifespan begin should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanEnd">Whether the lifespan end 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 artist Id 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="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAliases">Whether the aliases 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="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="ArtistMetadataDto"/>.</returns>
public ArtistMetadataDto Create(
string? name = null,
string? sortName = null,
string? disambiguation = null,
MusicArtistType? type = null,
MusicArtistGender? gender = null,
string? country = null,
MusicAreaDto? area = null,
MusicAreaDto? beginArea = null,
MusicAreaDto? endArea = null,
DateOnly? lifeSpanBegin = null,
DateOnly? lifeSpanEnd = null,
bool? isEnded = null,
string? website = null,
Guid? musicBrainzArtistId = null,
List<string>? ipis = null,
List<string>? isnis = null,
List<MusicArtistAliasDto>? aliases = null,
List<GenreDto>? genres = null,
List<TagDto>? tags = null,
List<AudioRatingDto>? ratings = null,
List<MediaContributorDto>? contributors = null,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeGender = true,
bool includeCountry = true,
bool includeArea = true,
bool includeBeginArea = true,
bool includeEndArea = true,
bool includeLifeSpanBegin = true,
bool includeLifeSpanEnd = true,
bool includeWebsite = true,
bool includeMusicBrainzArtistId = true,
bool includeIpis = true,
bool includeIsnis = true,
bool includeGenres = true,
bool includeTags = true,
bool includeAliases = true,
bool includeRatings = true,
bool includeContributors = true)
{
int lifeSpanBeginYear = Random.Shared.Next(MINIMUM_LIFESPAN_YEAR, MAXIMUM_LIFESPAN_YEAR);
int lifeSpanEndYear = Random.Shared.Next(lifeSpanBeginYear, Math.Max(lifeSpanBeginYear + 1, MAXIMUM_LIFESPAN_YEAR));
return new ArtistMetadataDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.PickRandom<MusicArtistType>()) : null,
includeGender ? (gender ?? _faker.PickRandom<MusicArtistGender>()) : null,
includeCountry ? (country ?? _faker.Address.CountryCode()) : null,
includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null,
includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null,
includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null,
includeLifeSpanBegin ? (lifeSpanBegin ?? new DateOnly(lifeSpanBeginYear, 1, 1)) : null,
includeLifeSpanEnd ? (lifeSpanEnd ?? new DateOnly(lifeSpanEndYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool(),
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,
includeAliases ? (aliases ?? _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeGenres ? (genres ?? _genreDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeTags ? (tags ?? _tagDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
/// Creates a list of <see cref="ArtistMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ArtistMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="ArtistMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ArtistMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="ArtistMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to.</param>
/// <param name="path">Optional. The file system path of a track of the artist.</param>
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
/// <param name="name">Optional. The name of the artist.</param>
/// <returns>The created <see cref="ArtistMetadataLookupDto"/>.</returns>
public ArtistMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzArtistId = null,
string? name = null)
{
return new ArtistMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzArtistId,
name);
}
/// <summary>
/// Creates a list of <see cref="ArtistMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ArtistMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,8 +1,13 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
@@ -26,6 +31,11 @@ public class AudioMetadataDtoFixture
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
private readonly IsrcDtoFixture _isrcDtoFixture = new();
private readonly MoodDtoFixture _moodDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="AudioMetadataDto"/>.
@@ -33,77 +43,135 @@ public class AudioMetadataDtoFixture
/// <param name="title">Optional. The title of the audio.</param>
/// <param name="originalTitle">Optional. The original title of the audio.</param>
/// <param name="description">Optional. A brief description or summary of the audio.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the audio.</param>
/// <param name="releaseInfo">Optional. The release information of the audio.</param>
/// <param name="language">Optional. The language of the audio.</param>
/// <param name="originalLanguage">Optional. The original language of the audio.</param>
/// <param name="tags">Optional. The tags that describe or categorize the audio.</param>
/// <param name="genres">Optional. The genres associated with the audio.</param>
/// <param name="script">Optional. The script used by the language of the audio.</param>
/// <param name="key">Optional. The musical key of the audio.</param>
/// <param name="bpm">Optional. The tempo of the audio, in beats per minute.</param>
/// <param name="isVideo">Optional. Whether the recording of the audio is a video recording.</param>
/// <param name="work">Optional. The work the audio is a recording of.</param>
/// <param name="isrcs">Optional. The ISRC codes of the audio.</param>
/// <param name="moods">Optional. The moods of the audio.</param>
/// <param name="durationInSeconds">Optional. The duration of the audio, in seconds.</param>
/// <param name="sampleRate">Optional. The sample rate of the audio, in Hz.</param>
/// <param name="channels">Optional. The number of audio channels.</param>
/// <param name="bitDepth">Optional. The bit depth of the audio.</param>
/// <param name="audioCodec">Optional. The audio codec used.</param>
/// <param name="bitrate">Optional. The bitrate of the audio, in kbps.</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="contributors">Optional. The media contributors that performed on the audio.</param>
/// <param name="ratings">Optional. The ratings of the audio.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeWork">Whether the work 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="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDurationInSeconds">Whether the duration should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSampleRate">Whether the sample rate should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeChannels">Whether the channels should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAudioCodec">Whether the audio codec should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBitrate">Whether the bitrate 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="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>
/// <returns>The created <see cref="AudioMetadataDto"/>.</returns>
public AudioMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
string? script = null,
MusicKey? key = null,
int? bpm = null,
bool? isVideo = null,
MusicWorkDto? work = null,
List<IsrcDto>? isrcs = null,
List<MoodDto>? moods = null,
int? durationInSeconds = null,
int? sampleRate = null,
int? channels = null,
int? bitDepth = null,
string? audioCodec = null,
int? bitrate = null,
Guid? musicBrainzRecordingId = null,
Guid? musicBrainzTrackId = null,
List<MediaContributorDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeScript = true,
bool includeKey = true,
bool includeBpm = true,
bool includeWork = true,
bool includeIsrcs = true,
bool includeMoods = true,
bool includeDurationInSeconds = true,
bool includeSampleRate = true,
bool includeChannels = true,
bool includeBitDepth = true,
bool includeAudioCodec = true,
bool includeBitrate = true)
bool includeBitrate = true,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeContributors = true,
bool includeRatings = true)
{
return new AudioMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
includeBpm ? (bpm ?? _faker.Random.Int(40, 220)) : null,
isVideo ?? _faker.Random.Bool(),
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
includeIsrcs ? (isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeMoods ? (moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Int(60, 7200)) : null,
includeSampleRate ? (sampleRate ?? _faker.Random.Int(8000, 192000)) : null,
includeChannels ? (channels ?? _faker.Random.Int(1, 8)) : null,
includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
includeAudioCodec ? (audioCodec ?? _faker.Random.ArrayElement(["FLAC", "MP3", "AAC", "ALAC"])) : null,
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null);
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null,
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
@@ -0,0 +1,179 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicAlbumMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicAlbumMetadataDtoFixture
{
private const int MINIMUM_RELEASE_YEAR = 1900;
private const int MAXIMUM_RELEASE_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicAlbumMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="originalTitle">Optional. The original title of the album.</param>
/// <param name="releaseTitle">Optional. The title of the specific release (edition) of the album.</param>
/// <param name="description">Optional. A brief description or summary of the album.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the album.</param>
/// <param name="releaseInfo">Optional. The release information of the album.</param>
/// <param name="language">Optional. The language of the album.</param>
/// <param name="originalLanguage">Optional. The original language of the album.</param>
/// <param name="tags">Optional. The tags that describe or categorize the album.</param>
/// <param name="genres">Optional. The genres associated with the album.</param>
/// <param name="script">Optional. The script used by the language of the release of the album.</param>
/// <param name="releaseTypes">Optional. The types of the release.</param>
/// <param name="releaseStatus">Optional. The status of the release.</param>
/// <param name="totalDiscs">Optional. The number of discs of the release.</param>
/// <param name="totalTracks">Optional. The number of tracks of the release.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseTypes">Whether the release types should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseStatus">Whether the release status should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalDiscs">Whether the total number of discs should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalTracks">Whether the total number of tracks should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicAlbumMetadataDto"/>.</returns>
public MusicAlbumMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? releaseTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
string? script = null,
List<MusicReleaseType>? releaseTypes = null,
MusicReleaseStatus? releaseStatus = null,
int? totalDiscs = null,
int? totalTracks = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeScript = true,
bool includeReleaseTypes = true,
bool includeReleaseStatus = true,
bool includeTotalDiscs = true,
bool includeTotalTracks = true,
bool includeReleaseTitle = true)
{
return new MusicAlbumMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeReleaseTypes ? (releaseTypes ?? [_faker.PickRandom<MusicReleaseType>()]) : null,
includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom<MusicReleaseStatus>()) : null,
includeTotalDiscs ? (totalDiscs ?? _faker.Random.Int(1, 3)) : null,
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null,
includeReleaseTitle ? (releaseTitle ?? _faker.Commerce.ProductName()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicAlbumMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicAlbumMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a random valid <see cref="ReleaseInfoDto"/> with consistent dates and years.
/// </summary>
/// <returns>The created <see cref="ReleaseInfoDto"/>.</returns>
private ReleaseInfoDto GenerateReleaseInfo()
{
int originalReleaseYear = Random.Shared.Next(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR);
int reReleaseYear = Random.Shared.Next(originalReleaseYear, MAXIMUM_RELEASE_YEAR);
return _releaseInfoDtoFixture.Create(
originalReleaseDate: new DateOnly(originalReleaseYear, 1, 1),
originalReleaseYear: originalReleaseYear,
reReleaseDate: new DateOnly(reReleaseYear, 1, 1),
reReleaseYear: reReleaseYear,
releaseCountry: _faker.PickRandom<ReleaseCountry>(),
releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50)));
}
/// <summary>
/// Creates two genres with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created genres.</returns>
private List<GenreDto> GenerateDistinctGenres()
{
return
[
_genreDtoFixture.Create(name: CreateUniqueName()),
_genreDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates two tags with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created tags.</returns>
private List<TagDto> GenerateDistinctTags()
{
return
[
_tagDtoFixture.Create(name: CreateUniqueName()),
_tagDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication.
/// </summary>
/// <returns>A unique name of at most 50 characters.</returns>
private string CreateUniqueName()
{
string uniqueSuffix = Guid.NewGuid().ToString("N")[..12];
int maximumWordLength = 50 - uniqueSuffix.Length - 1;
string word = _faker.Lorem.Word();
string truncatedWord = word.Length > maximumWordLength ? word[..maximumWordLength] : word;
return $"{truncatedWord}-{uniqueSuffix}";
}
}
@@ -0,0 +1,68 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicAreaDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicAreaDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="MusicAreaDto"/>.
/// </summary>
/// <param name="musicBrainzAreaId">Optional. The MusicBrainz identifier of the area.</param>
/// <param name="name">Optional. The name of the area.</param>
/// <param name="sortName">Optional. The sort name of the area.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the area.</param>
/// <param name="type">Optional. The MusicBrainz type of the area.</param>
/// <param name="iso3166Code">Optional. The ISO 3166 code of the area.</param>
/// <param name="includeMusicBrainzAreaId">Whether the MusicBrainz area 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="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIso3166Code">Whether the ISO 3166 code should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicAreaDto"/>.</returns>
public MusicAreaDto Create(
Guid? musicBrainzAreaId = null,
string? name = null,
string? sortName = null,
string? disambiguation = null,
string? type = null,
string? iso3166Code = null,
bool includeMusicBrainzAreaId = true,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeIso3166Code = true)
{
return new MusicAreaDto(
includeMusicBrainzAreaId ? (musicBrainzAreaId ?? _faker.Random.Guid()) : null,
includeName ? (name ?? _faker.Address.Country()) : null,
includeSortName ? (sortName ?? _faker.Address.Country()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Country", "City", "Area"])) : null,
includeIso3166Code ? (iso3166Code ?? _faker.Address.CountryCode()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicAreaDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicAreaDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,79 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicArtistAliasDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicArtistAliasDtoFixture
{
private const int MINIMUM_ALIAS_YEAR = 1900;
private const int MAXIMUM_ALIAS_YEAR = 2026;
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="MusicArtistAliasDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the alias.</param>
/// <param name="sortName">Optional. The sort name of the alias.</param>
/// <param name="type">Optional. The type of the alias.</param>
/// <param name="locale">Optional. The locale the alias is used in.</param>
/// <param name="isPrimary">Optional. Whether this is the primary alias of the artist.</param>
/// <param name="beginDate">Optional. The date the alias began being used.</param>
/// <param name="endDate">Optional. The date the alias stopped being used.</param>
/// <param name="isEnded">Optional. Whether the alias is no longer used.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLocale">Whether the locale should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginDate">Whether the begin date should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndDate">Whether the end date should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicArtistAliasDto"/>.</returns>
public MusicArtistAliasDto Create(
string? name = null,
string? sortName = null,
string? type = null,
string? locale = null,
bool? isPrimary = null,
DateOnly? beginDate = null,
DateOnly? endDate = null,
bool? isEnded = null,
bool includeName = true,
bool includeSortName = true,
bool includeType = true,
bool includeLocale = true,
bool includeBeginDate = true,
bool includeEndDate = true)
{
int beginYear = Random.Shared.Next(MINIMUM_ALIAS_YEAR, MAXIMUM_ALIAS_YEAR);
int endYear = Random.Shared.Next(beginYear, Math.Max(beginYear + 1, MAXIMUM_ALIAS_YEAR));
return new MusicArtistAliasDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Artist name", "Search hint"])) : null,
includeLocale ? (locale ?? _faker.Random.String2(2)) : null,
isPrimary ?? _faker.Random.Bool(),
includeBeginDate ? (beginDate ?? new DateOnly(beginYear, 1, 1)) : null,
includeEndDate ? (endDate ?? new DateOnly(endYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="MusicArtistAliasDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicArtistAliasDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,123 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicArtistMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicArtistMetadataDtoFixture
{
private const int MINIMUM_LIFESPAN_YEAR = 1900;
private const int MAXIMUM_LIFESPAN_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new();
private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicArtistMetadataDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="sortName">Optional. The sort name of the artist.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the artist.</param>
/// <param name="type">Optional. The type of the artist.</param>
/// <param name="gender">Optional. The gender of the artist.</param>
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">Optional. The area the artist is primarily identified with.</param>
/// <param name="beginArea">Optional. The area the artist began in.</param>
/// <param name="endArea">Optional. The area the artist ended in.</param>
/// <param name="lifeSpanBegin">Optional. The date the artist started existing.</param>
/// <param name="lifeSpanEnd">Optional. The date the artist stopped existing.</param>
/// <param name="isEnded">Optional. Whether the artist no longer exists.</param>
/// <param name="genres">Optional. The genres associated with the artist.</param>
/// <param name="tags">Optional. The tags that describe or categorize the artist.</param>
/// <param name="aliases">Optional. The alternative names of the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGender">Whether the gender should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginArea">Whether the begin area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndArea">Whether the end area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanBegin">Whether the lifespan begin should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanEnd">Whether the lifespan end should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAliases">Whether the aliases should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicArtistMetadataDto"/>.</returns>
public MusicArtistMetadataDto Create(
string? name = null,
string? sortName = null,
string? disambiguation = null,
MusicArtistType? type = null,
MusicArtistGender? gender = null,
string? country = null,
MusicAreaDto? area = null,
MusicAreaDto? beginArea = null,
MusicAreaDto? endArea = null,
DateOnly? lifeSpanBegin = null,
DateOnly? lifeSpanEnd = null,
bool? isEnded = null,
List<GenreDto>? genres = null,
List<TagDto>? tags = null,
List<MusicArtistAliasDto>? aliases = null,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeGender = true,
bool includeCountry = true,
bool includeArea = true,
bool includeBeginArea = true,
bool includeEndArea = true,
bool includeLifeSpanBegin = true,
bool includeLifeSpanEnd = true,
bool includeGenres = true,
bool includeTags = true,
bool includeAliases = true)
{
int lifeSpanBeginYear = Random.Shared.Next(MINIMUM_LIFESPAN_YEAR, MAXIMUM_LIFESPAN_YEAR);
int lifeSpanEndYear = Random.Shared.Next(lifeSpanBeginYear, Math.Max(lifeSpanBeginYear + 1, MAXIMUM_LIFESPAN_YEAR));
return new MusicArtistMetadataDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.PickRandom<MusicArtistType>()) : null,
includeGender ? (gender ?? _faker.PickRandom<MusicArtistGender>()) : null,
includeCountry ? (country ?? _faker.Address.CountryCode()) : null,
includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null,
includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null,
includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null,
includeLifeSpanBegin ? (lifeSpanBegin ?? new DateOnly(lifeSpanBeginYear, 1, 1)) : null,
includeLifeSpanEnd ? (lifeSpanEnd ?? new DateOnly(lifeSpanEndYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool(),
includeGenres ? (genres ?? _genreDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeTags ? (tags ?? _tagDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeAliases ? (aliases ?? _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicArtistMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicArtistMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,182 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicTrackMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicTrackMetadataDtoFixture
{
private const int MINIMUM_RELEASE_YEAR = 1900;
private const int MAXIMUM_RELEASE_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicTrackMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the track.</param>
/// <param name="originalTitle">Optional. The original title of the track.</param>
/// <param name="description">Optional. A brief description or summary of the track.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the track.</param>
/// <param name="releaseInfo">Optional. The release information of the track.</param>
/// <param name="language">Optional. The language of the track.</param>
/// <param name="originalLanguage">Optional. The original language of the track.</param>
/// <param name="tags">Optional. The tags that describe or categorize the track.</param>
/// <param name="genres">Optional. The genres associated with the track.</param>
/// <param name="isVideo">Optional. Whether the recording of the track is a video recording.</param>
/// <param name="durationInSeconds">Optional. The duration of the track, in seconds.</param>
/// <param name="sampleRate">Optional. The sample rate of the track, in Hz.</param>
/// <param name="channels">Optional. The number of audio channels.</param>
/// <param name="bitDepth">Optional. The bit depth of the track.</param>
/// <param name="audioCodec">Optional. The audio codec used.</param>
/// <param name="bitrate">Optional. The bitrate of the track, in kbps.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDurationInSeconds">Whether the duration should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSampleRate">Whether the sample rate should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeChannels">Whether the channels should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAudioCodec">Whether the audio codec should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBitrate">Whether the bitrate should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicTrackMetadataDto"/>.</returns>
public MusicTrackMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
bool? isVideo = null,
int? durationInSeconds = null,
int? sampleRate = null,
int? channels = null,
int? bitDepth = null,
string? audioCodec = null,
int? bitrate = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeDurationInSeconds = true,
bool includeSampleRate = true,
bool includeChannels = true,
bool includeBitDepth = true,
bool includeAudioCodec = true,
bool includeBitrate = true)
{
return new MusicTrackMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
isVideo ?? _faker.Random.Bool(),
includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Int(60, 7200)) : null,
includeSampleRate ? (sampleRate ?? _faker.Random.Int(8000, 192000)) : null,
includeChannels ? (channels ?? _faker.Random.Int(1, 8)) : null,
includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
includeAudioCodec ? (audioCodec ?? _faker.Random.ArrayElement(["FLAC", "MP3", "AAC", "ALAC"])) : null,
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicTrackMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicTrackMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a random valid <see cref="ReleaseInfoDto"/> with consistent dates and years.
/// </summary>
/// <returns>The created <see cref="ReleaseInfoDto"/>.</returns>
private ReleaseInfoDto GenerateReleaseInfo()
{
int originalReleaseYear = Random.Shared.Next(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR);
int reReleaseYear = Random.Shared.Next(originalReleaseYear, MAXIMUM_RELEASE_YEAR);
return _releaseInfoDtoFixture.Create(
originalReleaseDate: new DateOnly(originalReleaseYear, 1, 1),
originalReleaseYear: originalReleaseYear,
reReleaseDate: new DateOnly(reReleaseYear, 1, 1),
reReleaseYear: reReleaseYear,
releaseCountry: _faker.PickRandom<ReleaseCountry>(),
releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50)));
}
/// <summary>
/// Creates two genres with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created genres.</returns>
private List<GenreDto> GenerateDistinctGenres()
{
return
[
_genreDtoFixture.Create(name: CreateUniqueName()),
_genreDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates two tags with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created tags.</returns>
private List<TagDto> GenerateDistinctTags()
{
return
[
_tagDtoFixture.Create(name: CreateUniqueName()),
_tagDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication.
/// </summary>
/// <returns>A unique name of at most 50 characters.</returns>
private string CreateUniqueName()
{
string uniqueSuffix = Guid.NewGuid().ToString("N")[..12];
int maximumWordLength = 50 - uniqueSuffix.Length - 1;
string word = _faker.Lorem.Word();
string truncatedWord = word.Length > maximumWordLength ? word[..maximumWordLength] : word;
return $"{truncatedWord}-{uniqueSuffix}";
}
}
@@ -0,0 +1,75 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicWorkDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicWorkDtoFixture
{
private readonly Faker _faker = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicWorkDto"/>.
/// </summary>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
/// <param name="title">Optional. The title of the work.</param>
/// <param name="type">Optional. The MusicBrainz type of the work.</param>
/// <param name="languages">Optional. The list of languages of the work.</param>
/// <param name="iswcs">Optional. The list of ISWC of the work.</param>
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguages">Whether the languages should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIswcs">Whether the ISWCs should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicWorkDto"/>.</returns>
public MusicWorkDto Create(
Guid? musicBrainzWorkId = null,
string? title = null,
string? type = null,
List<LanguageInfoDto>? languages = null,
List<string>? iswcs = null,
bool includeMusicBrainzWorkId = true,
bool includeTitle = true,
bool includeType = true,
bool includeLanguages = true,
bool includeIswcs = true)
{
return new MusicWorkDto(
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Song", "Instrumental"])) : null,
includeLanguages ? (languages ?? _languageInfoDtoFixture.CreateMany(_faker.Random.Int(1, 2))) : null,
includeIswcs ? (iswcs ?? GenerateIswcs()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicWorkDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicWorkDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a list of random ISWC codes.
/// </summary>
/// <returns>The generated ISWC codes.</returns>
private List<string> GenerateIswcs()
{
return [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => $"T{_faker.Random.AlphaNumeric(10)}")];
}
}
@@ -0,0 +1,77 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="TrackMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class TrackMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="TrackMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the track belongs to.</param>
/// <param name="path">Optional. The file system path of the track.</param>
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording of the track.</param>
/// <param name="isrc">Optional. The ISRC of the track.</param>
/// <param name="title">Optional. The title of the track.</param>
/// <param name="artistName">Optional. The name of the artist of the track.</param>
/// <param name="releaseName">Optional. The name of the release the track belongs to.</param>
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release the track belongs to.</param>
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work the track is a recording of.</param>
/// <param name="workTitle">Optional. The title of the work the track is a recording of.</param>
/// <returns>The created <see cref="TrackMetadataLookupDto"/>.</returns>
public TrackMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzRecordingId = null,
string? isrc = null,
string? title = null,
string? artistName = null,
string? releaseName = null,
int? trackNumber = null,
int? durationInSeconds = null,
Guid? musicBrainzReleaseId = null,
int? discNumber = null,
Guid? musicBrainzWorkId = null,
string? workTitle = null)
{
return new TrackMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzRecordingId,
isrc,
title,
artistName,
releaseName,
trackNumber,
durationInSeconds,
musicBrainzReleaseId,
discNumber,
musicBrainzWorkId,
workTitle);
}
/// <summary>
/// Creates a list of <see cref="TrackMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<TrackMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}