mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Adds the music library browsing and editing pages to the web client.
This commit is contained in:
1 parent
c7aab63552
commit
5a2c6c2bd8
215 files changed
+60042
-3
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AudioRatingDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AudioRatingDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="AudioRatingDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="value">Optional. The numeric value of the rating.</param>
|
||||
/// <param name="maxValue">Optional. The maximum possible rating value.</param>
|
||||
/// <param name="voteCount">Optional. The number of votes the rating is based on.</param>
|
||||
/// <param name="source">Optional. The source of the audio rating.</param>
|
||||
/// <param name="includeValue">Whether the value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMaxValue">Whether the maximum value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeVoteCount">Whether the vote count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSource">Whether the source should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="AudioRatingDto"/> instance.</returns>
|
||||
public AudioRatingDto Create(
|
||||
decimal? value = null,
|
||||
decimal? maxValue = null,
|
||||
int? voteCount = null,
|
||||
AudioRatingSource? source = null,
|
||||
bool includeValue = true,
|
||||
bool includeMaxValue = true,
|
||||
bool includeVoteCount = true,
|
||||
bool includeSource = true)
|
||||
{
|
||||
return new AudioRatingDto
|
||||
{
|
||||
Value = includeValue ? (value ?? _faker.Random.Decimal(1, 5)) : null,
|
||||
MaxValue = includeMaxValue ? (maxValue ?? 5) : null,
|
||||
VoteCount = includeVoteCount ? (voteCount ?? _faker.Random.Number(1, 1000)) : null,
|
||||
Source = includeSource ? (source ?? _faker.PickRandom<AudioRatingSource>()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="AudioRatingDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="AudioRatingDto"/> instances.</returns>
|
||||
public List<AudioRatingDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="IsrcDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class IsrcDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="IsrcDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="value">Optional. The value of the ISRC.</param>
|
||||
/// <param name="includeValue">Whether the value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="IsrcDto"/> instance.</returns>
|
||||
public IsrcDto Create(
|
||||
string? value = null,
|
||||
bool includeValue = true)
|
||||
{
|
||||
return new IsrcDto
|
||||
{
|
||||
Value = includeValue ? (value ?? $"US{_faker.Random.String2(3, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")}{_faker.Random.Number(10000, 99999)}") : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="IsrcDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="IsrcDto"/> instances.</returns>
|
||||
public List<IsrcDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicAlbumDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicAlbumDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaArtworkDtoFixture _mediaArtworkDtoFixture = new();
|
||||
private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicAlbumDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the album.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the album belongs to.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library this album belongs to.</param>
|
||||
/// <param name="coverPath">Optional. The path of the image representing the album.</param>
|
||||
/// <param name="artwork">Optional. The stored artwork of the album.</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="catalogNumbers">Optional. The catalog numbers 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="createdOnUtc">Optional. The date and time when the album was created.</param>
|
||||
/// <param name="updatedOnUtc">Optional. The date and time when the album was updated.</param>
|
||||
/// <param name="contributors">Optional. The references to the media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</param>
|
||||
/// <param name="tracks">Optional. The tracks of the album.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtwork">Whether the artwork 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="includeCatalogNumbers">Whether the catalog numbers 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="includeUpdatedOnUtc">Whether the update date 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="includeTracks">Whether the tracks should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicAlbumDto"/> instance.</returns>
|
||||
public MusicAlbumDto Create(
|
||||
Guid? id = null,
|
||||
Guid? artistId = null,
|
||||
Guid? libraryId = null,
|
||||
string? coverPath = null,
|
||||
List<MediaArtworkDto>? artwork = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
DateTime? updatedOnUtc = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<MusicTrackDto>? tracks = null,
|
||||
bool includeCoverPath = true,
|
||||
bool includeArtwork = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
bool includeCatalogNumbers = true,
|
||||
bool includeLabel = true,
|
||||
bool includeAsin = true,
|
||||
bool includeMusicBrainzReleaseId = true,
|
||||
bool includeMusicBrainzReleaseGroupId = true,
|
||||
bool includeMusicBrainzReleaseArtistId = true,
|
||||
bool includeUpdatedOnUtc = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeTracks = true)
|
||||
{
|
||||
return new MusicAlbumDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
ArtistId = artistId ?? _faker.Random.Guid(),
|
||||
LibraryId = libraryId ?? _faker.Random.Guid(),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
Artwork = includeArtwork ? (artwork ?? [.. _mediaArtworkDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Metadata = includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
MediaFormat = includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
Packaging = includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
Barcode = includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
CatalogNumbers = includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null,
|
||||
Label = includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
ASIN = includeAsin ? (asin ?? _faker.Random.String2(10)) : null,
|
||||
MusicBrainzReleaseId = includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseGroupId = includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseArtistId = includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(),
|
||||
UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null,
|
||||
Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Tracks = includeTracks ? (tracks ?? [.. _musicTrackDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicAlbumDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicAlbumDto"/> instances.</returns>
|
||||
public List<MusicAlbumDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicAlbumLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicAlbumLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicAlbumLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the album.</param>
|
||||
/// <param name="title">Optional. The title of the album.</param>
|
||||
/// <param name="totalTracks">Optional. The number of tracks of the release.</param>
|
||||
/// <param name="coverPath">Optional. The path of the image representing the album.</param>
|
||||
/// <param name="releaseYear">Optional. The release year of the album.</param>
|
||||
/// <param name="releaseTypes">Optional. The set of types of the release.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReleaseYear">Whether the release year 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>
|
||||
/// <returns>A configured <see cref="MusicAlbumLiteDto"/> instance.</returns>
|
||||
public MusicAlbumLiteDto Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? totalTracks = null,
|
||||
string? coverPath = null,
|
||||
int? releaseYear = null,
|
||||
List<MusicReleaseType>? releaseTypes = null,
|
||||
bool includeCoverPath = true,
|
||||
bool includeReleaseYear = true,
|
||||
bool includeReleaseTypes = true)
|
||||
{
|
||||
return new MusicAlbumLiteDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Title = title ?? _faker.Lorem.Sentence(3),
|
||||
TotalTracks = totalTracks ?? _faker.Random.Number(1, 30),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
ReleaseYear = includeReleaseYear ? (releaseYear ?? Random.Shared.Next(1900, 2026)) : null,
|
||||
ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.PickRandom<MusicReleaseType>())]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicAlbumLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicAlbumLiteDto"/> instances.</returns>
|
||||
public List<MusicAlbumLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicAlbumMetadataDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicAlbumMetadataDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicAlbumMetadataDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="title">Optional. The title of the album.</param>
|
||||
/// <param name="originalTitle">Optional. The original title of the album.</param>
|
||||
/// <param name="description">Optional. A brief description 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 set of 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="releaseTitle">Optional. The title of the specific release the album files match.</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>
|
||||
/// <param name="includeReleaseTitle">Whether the release title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicAlbumMetadataDto"/> instance.</returns>
|
||||
public MusicAlbumMetadataDto 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,
|
||||
List<MusicReleaseType>? releaseTypes = null,
|
||||
MusicReleaseStatus? releaseStatus = null,
|
||||
int? totalDiscs = null,
|
||||
int? totalTracks = null,
|
||||
string? releaseTitle = 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
|
||||
{
|
||||
Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null,
|
||||
OriginalTitle = includeOriginalTitle ? (originalTitle ?? _faker.Lorem.Sentence(3)) : null,
|
||||
Description = includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
|
||||
Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null,
|
||||
ReleaseInfo = includeReleaseInfo ? (releaseInfo ?? _releaseInfoDtoFixture.Create()) : null,
|
||||
Language = includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
|
||||
OriginalLanguage = includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
|
||||
Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Script = includeScript ? (script ?? _faker.Lorem.Word()) : null,
|
||||
ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.PickRandom<MusicReleaseType>())]) : null,
|
||||
ReleaseStatus = includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom<MusicReleaseStatus>()) : null,
|
||||
TotalDiscs = includeTotalDiscs ? (totalDiscs ?? _faker.Random.Number(1, 4)) : null,
|
||||
TotalTracks = includeTotalTracks ? (totalTracks ?? _faker.Random.Number(1, 30)) : null,
|
||||
ReleaseTitle = includeReleaseTitle ? (releaseTitle ?? _faker.Lorem.Sentence(3)) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicAlbumMetadataDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicAlbumMetadataDto"/> instances.</returns>
|
||||
public List<MusicAlbumMetadataDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicAreaDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicAreaDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicAreaDto"/> instance with randomized test data.
|
||||
/// </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>A configured <see cref="MusicAreaDto"/> instance.</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
|
||||
{
|
||||
MusicBrainzAreaId = includeMusicBrainzAreaId ? (musicBrainzAreaId ?? _faker.Random.Guid()) : null,
|
||||
Name = includeName ? (name ?? _faker.Address.Country()) : null,
|
||||
SortName = includeSortName ? (sortName ?? _faker.Address.Country()) : null,
|
||||
Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null,
|
||||
Type = includeType ? (type ?? _faker.Lorem.Word()) : null,
|
||||
Iso3166Code = includeIso3166Code ? (iso3166Code ?? _faker.Address.CountryCode()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicAreaDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicAreaDto"/> instances.</returns>
|
||||
public List<MusicAreaDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicArtistAliasDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicArtistAliasDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicArtistAliasDto"/> instance with randomized test data.
|
||||
/// </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>A configured <see cref="MusicArtistAliasDto"/> instance.</returns>
|
||||
public MusicArtistAliasDto Create(
|
||||
string? name = null,
|
||||
string? sortName = null,
|
||||
string? type = null,
|
||||
string? locale = null,
|
||||
bool isPrimary = false,
|
||||
DateOnly? beginDate = null,
|
||||
DateOnly? endDate = null,
|
||||
bool isEnded = false,
|
||||
bool includeName = true,
|
||||
bool includeSortName = true,
|
||||
bool includeType = true,
|
||||
bool includeLocale = true,
|
||||
bool includeBeginDate = true,
|
||||
bool includeEndDate = true)
|
||||
{
|
||||
DateOnly resolvedBeginDate = beginDate ?? DateOnly.FromDateTime(_faker.Date.Past());
|
||||
DateOnly resolvedEndDate = endDate ?? DateOnly.FromDateTime(_faker.Date.Future());
|
||||
|
||||
return new MusicArtistAliasDto
|
||||
{
|
||||
Name = includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
SortName = includeSortName ? (sortName ?? _faker.Name.LastName()) : null,
|
||||
Type = includeType ? (type ?? _faker.Lorem.Word()) : null,
|
||||
Locale = includeLocale ? (locale ?? _faker.Random.String2(2, "abcdefghijklmnopqrstuvwxyz")) : null,
|
||||
IsPrimary = isPrimary,
|
||||
BeginDate = includeBeginDate ? resolvedBeginDate : null,
|
||||
EndDate = includeEndDate ? resolvedEndDate : null,
|
||||
IsEnded = isEnded
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicArtistAliasDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicArtistAliasDto"/> instances.</returns>
|
||||
public List<MusicArtistAliasDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicArtistDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicArtistDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicArtistDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the artist.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library this artist belongs to.</param>
|
||||
/// <param name="coverPath">Optional. The path of the image representing 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="createdOnUtc">Optional. The date and time when the artist was created.</param>
|
||||
/// <param name="updatedOnUtc">Optional. The date and time when the artist was updated.</param>
|
||||
/// <param name="contributors">Optional. The references to 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.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path 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 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="includeUpdatedOnUtc">Whether the update date 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>A configured <see cref="MusicArtistDto"/> instance.</returns>
|
||||
public MusicArtistDto Create(
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
string? coverPath = null,
|
||||
MusicArtistMetadataDto? metadata = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<string>? ipis = null,
|
||||
List<string>? isnis = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
DateTime? updatedOnUtc = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<MusicAlbumDto>? albums = null,
|
||||
bool includeCoverPath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeUpdatedOnUtc = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
return new MusicArtistDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
LibraryId = libraryId ?? _faker.Random.Guid(),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
Metadata = includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
Website = includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
MusicBrainzArtistId = includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
Ipis = includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10, "0123456789"))]) : null,
|
||||
Isnis = includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))]) : null,
|
||||
CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(),
|
||||
UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null,
|
||||
Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Albums = includeAlbums ? (albums ?? [.. _musicAlbumDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicArtistDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicArtistDto"/> instances.</returns>
|
||||
public List<MusicArtistDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicArtistLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicArtistLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicArtistLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the artist.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="coverPath">Optional. The path of the image representing the artist.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicArtistLiteDto"/> instance.</returns>
|
||||
public MusicArtistLiteDto Create(
|
||||
Guid? id = null,
|
||||
string? name = null,
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new MusicArtistLiteDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Name = name ?? _faker.Name.FullName(),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicArtistLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicArtistLiteDto"/> instances.</returns>
|
||||
public List<MusicArtistLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicArtistMetadataDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicArtistMetadataDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new();
|
||||
private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicArtistMetadataDto"/> instance with randomized test data.
|
||||
/// </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 the artist is associated with.</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 life span begin date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeLifeSpanEnd">Whether the life span end date 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>A configured <see cref="MusicArtistMetadataDto"/> instance.</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 = false,
|
||||
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)
|
||||
{
|
||||
return new MusicArtistMetadataDto
|
||||
{
|
||||
Name = includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
SortName = includeSortName ? (sortName ?? _faker.Name.LastName()) : null,
|
||||
Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null,
|
||||
Type = includeType ? (type ?? _faker.PickRandom<MusicArtistType>()) : null,
|
||||
Gender = includeGender ? (gender ?? _faker.PickRandom<MusicArtistGender>()) : null,
|
||||
Country = includeCountry ? (country ?? _faker.Address.CountryCode()) : null,
|
||||
Area = includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null,
|
||||
BeginArea = includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null,
|
||||
EndArea = includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null,
|
||||
LifeSpanBegin = includeLifeSpanBegin ? (lifeSpanBegin ?? DateOnly.FromDateTime(_faker.Date.Past())) : null,
|
||||
LifeSpanEnd = includeLifeSpanEnd ? (lifeSpanEnd ?? DateOnly.FromDateTime(_faker.Date.Past())) : null,
|
||||
IsEnded = isEnded,
|
||||
Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Aliases = includeAliases ? (aliases ?? [.. _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicArtistMetadataDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicArtistMetadataDto"/> instances.</returns>
|
||||
public List<MusicArtistMetadataDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicTrackDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicTrackDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = 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();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicTrackDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the track.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the track belongs to.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library this track belongs to.</param>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <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 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="createdOnUtc">Optional. The date and time when the track was created.</param>
|
||||
/// <param name="updatedOnUtc">Optional. The date and time when the track was updated.</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 references to the media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number 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="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="includeUpdatedOnUtc">Whether the update date 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>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicTrackDto"/> instance.</returns>
|
||||
public MusicTrackDto Create(
|
||||
Guid? id = null,
|
||||
Guid? albumId = null,
|
||||
Guid? libraryId = null,
|
||||
string? path = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
DateTime? updatedOnUtc = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeUpdatedOnUtc = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new MusicTrackDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
AlbumId = albumId ?? _faker.Random.Guid(),
|
||||
LibraryId = libraryId ?? _faker.Random.Guid(),
|
||||
Path = path ?? _faker.System.FilePath(),
|
||||
Metadata = includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
TrackNumber = trackNumber ?? _faker.Random.Number(1, 30),
|
||||
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 3)) : null,
|
||||
Script = includeScript ? (script ?? _faker.Lorem.Word()) : null,
|
||||
Key = includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
Bpm = includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null,
|
||||
Work = includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
MusicBrainzRecordingId = includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzTrackId = includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(),
|
||||
UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null,
|
||||
Moods = includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Isrcs = includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicTrackDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicTrackDto"/> instances.</returns>
|
||||
public List<MusicTrackDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicTrackLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicTrackLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicTrackLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the track.</param>
|
||||
/// <param name="title">Optional. The title of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicTrackLiteDto"/> instance.</returns>
|
||||
public MusicTrackLiteDto Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
int? durationInSeconds = null,
|
||||
bool includeDiscNumber = true)
|
||||
{
|
||||
return new MusicTrackLiteDto
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Title = title ?? _faker.Lorem.Sentence(3),
|
||||
TrackNumber = trackNumber ?? _faker.Random.Number(1, 30),
|
||||
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 3)) : null,
|
||||
DurationInSeconds = durationInSeconds ?? _faker.Random.Number(30, 600)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicTrackLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicTrackLiteDto"/> instances.</returns>
|
||||
public List<MusicTrackLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicTrackMetadataDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicTrackMetadataDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicTrackMetadataDto"/> instance with randomized test data.
|
||||
/// </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 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 audio of the track in seconds.</param>
|
||||
/// <param name="sampleRate">Optional. The sample rate of the audio of the track in Hz.</param>
|
||||
/// <param name="channels">Optional. The number of audio channels of the track.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the audio of the track.</param>
|
||||
/// <param name="audioCodec">Optional. The audio codec used by the track.</param>
|
||||
/// <param name="bitrate">Optional. The bitrate of the audio of the track in kbps.</param>
|
||||
/// <param name="acoustId">Optional. The AcoustID fingerprint identifier of the audio file of the track.</param>
|
||||
/// <param name="replayGainTrackGain">Optional. The ReplayGain track gain of the track in decibels.</param>
|
||||
/// <param name="replayGainTrackPeak">Optional. The ReplayGain track peak of the track.</param>
|
||||
/// <param name="replayGainAlbumGain">Optional. The ReplayGain album gain of the track in decibels.</param>
|
||||
/// <param name="replayGainAlbumPeak">Optional. The ReplayGain album peak of the track.</param>
|
||||
/// <param name="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>
|
||||
/// <param name="includeAcoustId">Whether the AcoustID should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGainTrackGain">Whether the ReplayGain track gain should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGainTrackPeak">Whether the ReplayGain track peak should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGainAlbumGain">Whether the ReplayGain album gain should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGainAlbumPeak">Whether the ReplayGain album peak should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicTrackMetadataDto"/> instance.</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 = false,
|
||||
int? durationInSeconds = null,
|
||||
int? sampleRate = null,
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
string? audioCodec = null,
|
||||
int? bitrate = null,
|
||||
string? acoustId = null,
|
||||
decimal? replayGainTrackGain = null,
|
||||
decimal? replayGainTrackPeak = null,
|
||||
decimal? replayGainAlbumGain = null,
|
||||
decimal? replayGainAlbumPeak = 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,
|
||||
bool includeAcoustId = true,
|
||||
bool includeReplayGainTrackGain = true,
|
||||
bool includeReplayGainTrackPeak = true,
|
||||
bool includeReplayGainAlbumGain = true,
|
||||
bool includeReplayGainAlbumPeak = true)
|
||||
{
|
||||
return new MusicTrackMetadataDto
|
||||
{
|
||||
Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null,
|
||||
OriginalTitle = includeOriginalTitle ? (originalTitle ?? _faker.Lorem.Sentence(3)) : null,
|
||||
Description = includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
|
||||
Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null,
|
||||
ReleaseInfo = includeReleaseInfo ? (releaseInfo ?? _releaseInfoDtoFixture.Create()) : null,
|
||||
Language = includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
|
||||
OriginalLanguage = includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
|
||||
Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
IsVideo = isVideo,
|
||||
DurationInSeconds = includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Number(30, 600)) : null,
|
||||
SampleRate = includeSampleRate ? (sampleRate ?? _faker.Random.Number(22050, 192000)) : null,
|
||||
Channels = includeChannels ? (channels ?? _faker.Random.Number(1, 8)) : null,
|
||||
BitDepth = includeBitDepth ? (bitDepth ?? _faker.Random.Number(8, 32)) : null,
|
||||
AudioCodec = includeAudioCodec ? (audioCodec ?? _faker.Lorem.Word()) : null,
|
||||
Bitrate = includeBitrate ? (bitrate ?? _faker.Random.Number(64, 1411)) : null,
|
||||
AcoustId = includeAcoustId ? (acoustId ?? _faker.Random.String2(32, "0123456789abcdef")) : null,
|
||||
ReplayGainTrackGain = includeReplayGainTrackGain ? (replayGainTrackGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
ReplayGainTrackPeak = includeReplayGainTrackPeak ? (replayGainTrackPeak ?? _faker.Random.Decimal(0m, 1m)) : null,
|
||||
ReplayGainAlbumGain = includeReplayGainAlbumGain ? (replayGainAlbumGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
ReplayGainAlbumPeak = includeReplayGainAlbumPeak ? (replayGainAlbumPeak ?? _faker.Random.Decimal(0m, 1m)) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicTrackMetadataDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicTrackMetadataDto"/> instances.</returns>
|
||||
public List<MusicTrackMetadataDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicWorkDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MusicWorkDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicWorkDto"/> instance with randomized test data.
|
||||
/// </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 languages of the work.</param>
|
||||
/// <param name="iswcs">Optional. The ISWC codes 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 ISWC codes should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicWorkDto"/> instance.</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
|
||||
{
|
||||
MusicBrainzWorkId = includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
|
||||
Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null,
|
||||
Type = includeType ? (type ?? _faker.Lorem.Word()) : null,
|
||||
Languages = includeLanguages ? (languages ?? [.. _languageInfoDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Iswcs = includeIswcs ? (iswcs ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => $"T{_faker.Random.Number(100000000, 999999999)}")]) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicWorkDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicWorkDto"/> instances.</returns>
|
||||
public List<MusicWorkDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PaginatedMusicAlbumLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PaginatedMusicAlbumLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumLiteDtoFixture _musicAlbumLiteDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="PaginatedMusicAlbumLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="data">Optional. The collection of lightweight album elements.</param>
|
||||
/// <param name="currentPage">Optional. The current page number in the paginated collection.</param>
|
||||
/// <param name="perPage">Optional. The number of items to include per page.</param>
|
||||
/// <param name="count">Optional. The total number of elements available in the result set.</param>
|
||||
/// <param name="numberOfPages">Optional. The total number of pages available.</param>
|
||||
/// <returns>A configured <see cref="PaginatedMusicAlbumLiteDto"/> instance.</returns>
|
||||
public PaginatedMusicAlbumLiteDto Create(
|
||||
IReadOnlyList<MusicAlbumLiteDto>? data = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
int? count = null,
|
||||
int? numberOfPages = null)
|
||||
{
|
||||
return new PaginatedMusicAlbumLiteDto
|
||||
{
|
||||
Data = data ?? [.. _musicAlbumLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
|
||||
CurrentPage = currentPage ?? _faker.Random.Int(1, 10),
|
||||
PerPage = perPage ?? _faker.Random.Int(1, 100),
|
||||
Count = count ?? _faker.Random.Int(0, 1000),
|
||||
NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="PaginatedMusicAlbumLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PaginatedMusicAlbumLiteDto"/> instances.</returns>
|
||||
public List<PaginatedMusicAlbumLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PaginatedMusicArtistLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PaginatedMusicArtistLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistLiteDtoFixture _musicArtistLiteDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="PaginatedMusicArtistLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="data">Optional. The collection of lightweight artist elements.</param>
|
||||
/// <param name="currentPage">Optional. The current page number in the paginated collection.</param>
|
||||
/// <param name="perPage">Optional. The number of items to include per page.</param>
|
||||
/// <param name="count">Optional. The total number of elements available in the result set.</param>
|
||||
/// <param name="numberOfPages">Optional. The total number of pages available.</param>
|
||||
/// <returns>A configured <see cref="PaginatedMusicArtistLiteDto"/> instance.</returns>
|
||||
public PaginatedMusicArtistLiteDto Create(
|
||||
IReadOnlyList<MusicArtistLiteDto>? data = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
int? count = null,
|
||||
int? numberOfPages = null)
|
||||
{
|
||||
return new PaginatedMusicArtistLiteDto
|
||||
{
|
||||
Data = data ?? [.. _musicArtistLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
|
||||
CurrentPage = currentPage ?? _faker.Random.Int(1, 10),
|
||||
PerPage = perPage ?? _faker.Random.Int(1, 100),
|
||||
Count = count ?? _faker.Random.Int(0, 1000),
|
||||
NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="PaginatedMusicArtistLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PaginatedMusicArtistLiteDto"/> instances.</returns>
|
||||
public List<PaginatedMusicArtistLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PaginatedMusicTrackLiteDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PaginatedMusicTrackLiteDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicTrackLiteDtoFixture _musicTrackLiteDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="PaginatedMusicTrackLiteDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="data">Optional. The collection of lightweight track elements.</param>
|
||||
/// <param name="currentPage">Optional. The current page number in the paginated collection.</param>
|
||||
/// <param name="perPage">Optional. The number of items to include per page.</param>
|
||||
/// <param name="count">Optional. The total number of elements available in the result set.</param>
|
||||
/// <param name="numberOfPages">Optional. The total number of pages available.</param>
|
||||
/// <returns>A configured <see cref="PaginatedMusicTrackLiteDto"/> instance.</returns>
|
||||
public PaginatedMusicTrackLiteDto Create(
|
||||
IReadOnlyList<MusicTrackLiteDto>? data = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
int? count = null,
|
||||
int? numberOfPages = null)
|
||||
{
|
||||
return new PaginatedMusicTrackLiteDto
|
||||
{
|
||||
Data = data ?? [.. _musicTrackLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))],
|
||||
CurrentPage = currentPage ?? _faker.Random.Int(1, 10),
|
||||
PerPage = perPage ?? _faker.Random.Int(1, 100),
|
||||
Count = count ?? _faker.Random.Int(0, 1000),
|
||||
NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="PaginatedMusicTrackLiteDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PaginatedMusicTrackLiteDto"/> instances.</returns>
|
||||
public List<PaginatedMusicTrackLiteDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicCoverDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicCoverDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicCoverDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="coverPath">Optional. The relative path of the stored cover image.</param>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UpdateMusicCoverDto"/> instance.</returns>
|
||||
public UpdateMusicCoverDto Create(
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new UpdateMusicCoverDto
|
||||
{
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicCoverDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicCoverDto"/> instances.</returns>
|
||||
public List<UpdateMusicCoverDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MediaArtworkDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaArtworkDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MediaArtworkDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="type">Optional. The type of the artwork.</param>
|
||||
/// <param name="ordinal">Optional. The ordinal of the artwork within its type.</param>
|
||||
/// <param name="path">Optional. The relative path of the stored artwork file.</param>
|
||||
/// <returns>A configured <see cref="MediaArtworkDto"/> instance.</returns>
|
||||
public MediaArtworkDto Create(
|
||||
ArtworkType? type = null,
|
||||
int? ordinal = null,
|
||||
string? path = null)
|
||||
{
|
||||
return new MediaArtworkDto
|
||||
{
|
||||
Type = type ?? _faker.PickRandom<ArtworkType>(),
|
||||
Ordinal = ordinal ?? _faker.Random.Int(1, 10),
|
||||
Path = path ?? _faker.System.FilePath()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MediaArtworkDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MediaArtworkDto"/> instances.</returns>
|
||||
public List<MediaArtworkDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MoodDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MoodDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MoodDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the mood.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MoodDto"/> instance.</returns>
|
||||
public MoodDto Create(
|
||||
string? name = null,
|
||||
bool includeName = true)
|
||||
{
|
||||
return new MoodDto
|
||||
{
|
||||
Name = includeName ? (name ?? _faker.Lorem.Word()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MoodDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MoodDto"/> instances.</returns>
|
||||
public List<MoodDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MediaContributorReferenceDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaContributorReferenceDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MediaContributorReferenceDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="contributorId">Optional. The unique identifier of the media contributor.</param>
|
||||
/// <param name="role">Optional. The role the contributor played.</param>
|
||||
/// <param name="includeRole">Whether the role should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MediaContributorReferenceDto"/> instance.</returns>
|
||||
public MediaContributorReferenceDto Create(
|
||||
Guid? contributorId = null,
|
||||
MediaContributorRole? role = null,
|
||||
bool includeRole = true)
|
||||
{
|
||||
return new MediaContributorReferenceDto
|
||||
{
|
||||
ContributorId = contributorId ?? _faker.Random.Guid(),
|
||||
Role = includeRole ? (role ?? _faker.PickRandom<MediaContributorRole>()) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MediaContributorReferenceDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MediaContributorReferenceDto"/> instances.</returns>
|
||||
public List<MediaContributorReferenceDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistAlbumsLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistAlbumsLiteRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetArtistAlbumsLiteRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="artistId">Optional Id of the artist whose albums are retrieved.</param>
|
||||
/// <param name="libraryId">Optional Id of the media library the artist belongs to.</param>
|
||||
/// <param name="currentPage">Optional page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional maximum number of albums to retrieve per page.</param>
|
||||
/// <returns>A configured <see cref="GetArtistAlbumsLiteRequest"/> instance.</returns>
|
||||
public GetArtistAlbumsLiteRequest Create(
|
||||
string? artistId = null,
|
||||
Guid? libraryId = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null)
|
||||
{
|
||||
return new GetArtistAlbumsLiteRequest(
|
||||
ArtistId: artistId ?? Guid.NewGuid().ToString(),
|
||||
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||
CurrentPage: currentPage,
|
||||
PerPage: perPage
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="GetArtistAlbumsLiteRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistAlbumsLiteRequest"/> instances.</returns>
|
||||
public List<GetArtistAlbumsLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMusicAlbumViewRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMusicAlbumViewRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetMusicAlbumViewRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="artistId">Optional unique identifier of the artist the album belongs to.</param>
|
||||
/// <param name="albumId">Optional unique identifier of the album to retrieve.</param>
|
||||
/// <param name="libraryId">Optional unique identifier of the media library the album belongs to.</param>
|
||||
/// <returns>A configured <see cref="GetMusicAlbumViewRequest"/> instance.</returns>
|
||||
public GetMusicAlbumViewRequest Create(
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetMusicAlbumViewRequest(
|
||||
artistId ?? Guid.NewGuid().ToString(),
|
||||
albumId ?? Guid.NewGuid().ToString(),
|
||||
libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetMusicAlbumViewRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMusicAlbumViewRequest"/> instances.</returns>
|
||||
public List<GetMusicAlbumViewRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicAlbumRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicAlbumRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicAlbumRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <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="catalogNumbers">Optional. The catalog numbers 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 references to the media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</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="includeCatalogNumbers">Whether the catalog numbers 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>A configured <see cref="UpdateMusicAlbumRequest"/> instance.</returns>
|
||||
public UpdateMusicAlbumRequest Create(
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = 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)
|
||||
{
|
||||
return new UpdateMusicAlbumRequest(
|
||||
Metadata: includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
MediaFormat: includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
Packaging: includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
Barcode: includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
CatalogNumbers: includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null,
|
||||
Label: includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
ASIN: includeAsin ? (asin ?? _faker.Random.String2(10)) : null,
|
||||
MusicBrainzReleaseId: includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseGroupId: includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseArtistId: includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicAlbumRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicAlbumRequest"/> instances.</returns>
|
||||
public List<UpdateMusicAlbumRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMusicArtistViewRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMusicArtistViewRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetMusicArtistViewRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="artistId">Optional unique identifier of the artist to retrieve.</param>
|
||||
/// <param name="libraryId">Optional unique identifier of the media library the artist belongs to.</param>
|
||||
/// <returns>A configured <see cref="GetMusicArtistViewRequest"/> instance.</returns>
|
||||
public GetMusicArtistViewRequest Create(
|
||||
string? artistId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetMusicArtistViewRequest(
|
||||
artistId ?? Guid.NewGuid().ToString(),
|
||||
libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetMusicArtistViewRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMusicArtistViewRequest"/> instances.</returns>
|
||||
public List<GetMusicArtistViewRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.Enums.Common;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMusicArtistsLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMusicArtistsLiteRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetMusicArtistsLiteRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional Id of the media library whose artists are retrieved.</param>
|
||||
/// <param name="currentPage">Optional page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional maximum number of artists to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional search term used to filter the artists by name.</param>
|
||||
/// <param name="filterAlphaKey">Optional alpha key used to filter the results by the first character of their name.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional whether the leading prefix of a name is ignored when computing the alpha key.</param>
|
||||
/// <param name="sortBy">Optional name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional direction in which to sort the results.</param>
|
||||
/// <param name="includeCurrentPage">Whether the current page should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePerPage">Whether the per page count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSearchTerm">Whether the search term should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeFilterAlphaKey">Whether the alpha key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSortBy">Whether the sort field should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSortOrder">Whether the sort order should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="GetMusicArtistsLiteRequest"/> instance.</returns>
|
||||
public GetMusicArtistsLiteRequest Create(
|
||||
Guid? libraryId = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null,
|
||||
bool includeCurrentPage = true,
|
||||
bool includePerPage = true,
|
||||
bool includeSearchTerm = true,
|
||||
bool includeFilterAlphaKey = true,
|
||||
bool includeSortBy = true,
|
||||
bool includeSortOrder = true)
|
||||
{
|
||||
return new GetMusicArtistsLiteRequest(
|
||||
LibraryId: libraryId ?? _faker.Random.Guid(),
|
||||
CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Int(1, 100)) : null,
|
||||
PerPage: includePerPage ? (perPage ?? _faker.Random.Int(1, 100)) : null,
|
||||
SearchTerm: includeSearchTerm ? (searchTerm ?? _faker.Lorem.Word()) : null,
|
||||
FilterAlphaKey: includeFilterAlphaKey ? (filterAlphaKey ?? _faker.Random.String2(1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) : null,
|
||||
ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker,
|
||||
SortBy: includeSortBy ? (sortBy ?? _faker.Lorem.Word()) : null,
|
||||
SortOrder: includeSortOrder ? (sortOrder ?? _faker.PickRandom<SortOrder>()) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="GetMusicArtistsLiteRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMusicArtistsLiteRequest"/> instances.</returns>
|
||||
public List<GetMusicArtistsLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMusicArtistsViewRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMusicArtistsViewRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetMusicArtistsViewRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional unique identifier of the media library whose artists are browsed.</param>
|
||||
/// <returns>A configured <see cref="GetMusicArtistsViewRequest"/> instance.</returns>
|
||||
public GetMusicArtistsViewRequest Create(
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetMusicArtistsViewRequest(
|
||||
LibraryId: libraryId
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="GetMusicArtistsViewRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMusicArtistsViewRequest"/> instances.</returns>
|
||||
public List<GetMusicArtistsViewRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicArtistAlbumRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicArtistAlbumRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly UpdateMusicArtistTrackRequestFixture _updateMusicArtistTrackRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicArtistAlbumRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="albumId">Optional. The Id of the album, when the album already exists.</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="catalogNumbers">Optional. The catalog numbers 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 references to the media contributors that performed on the album.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the album.</param>
|
||||
/// <param name="tracks">Optional. The tracks of the album.</param>
|
||||
/// <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="includeCatalogNumbers">Whether the catalog numbers 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>
|
||||
/// <param name="includeTracks">Whether the tracks should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UpdateMusicArtistAlbumRequest"/> instance.</returns>
|
||||
public UpdateMusicArtistAlbumRequest Create(
|
||||
Guid? albumId = null,
|
||||
MusicAlbumMetadataDto? metadata = null,
|
||||
MusicMediaFormat? mediaFormat = null,
|
||||
MusicReleasePackaging? packaging = null,
|
||||
string? barcode = null,
|
||||
List<string>? catalogNumbers = null,
|
||||
string? label = null,
|
||||
string? asin = null,
|
||||
Guid? musicBrainzReleaseId = null,
|
||||
Guid? musicBrainzReleaseGroupId = null,
|
||||
Guid? musicBrainzReleaseArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<UpdateMusicArtistTrackRequest>? tracks = null,
|
||||
bool includeAlbumId = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = 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 includeTracks = true)
|
||||
{
|
||||
return new UpdateMusicArtistAlbumRequest(
|
||||
AlbumId: includeAlbumId ? (albumId ?? _faker.Random.Guid()) : null,
|
||||
Metadata: includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
|
||||
MediaFormat: includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
|
||||
Packaging: includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
|
||||
Barcode: includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
|
||||
CatalogNumbers: includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null,
|
||||
Label: includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
|
||||
ASIN: includeAsin ? (asin ?? _faker.Random.String2(10)) : null,
|
||||
MusicBrainzReleaseId: includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseGroupId: includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzReleaseArtistId: includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
|
||||
Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Tracks: includeTracks ? (tracks ?? [.. _updateMusicArtistTrackRequestFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicArtistAlbumRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicArtistAlbumRequest"/> instances.</returns>
|
||||
public List<UpdateMusicArtistAlbumRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicArtistRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicArtistRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly UpdateMusicArtistAlbumRequestFixture _updateMusicArtistAlbumRequestFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicArtistRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <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 references to 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 list of tracks.</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 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="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>A configured <see cref="UpdateMusicArtistRequest"/> instance.</returns>
|
||||
public UpdateMusicArtistRequest Create(
|
||||
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<UpdateMusicArtistAlbumRequest>? albums = null,
|
||||
bool includeMetadata = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
bool includeIsnis = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
return new UpdateMusicArtistRequest(
|
||||
Metadata: includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
|
||||
Website: includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
MusicBrainzArtistId: includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
Ipis: includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10, "0123456789"))]) : null,
|
||||
Isnis: includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))]) : null,
|
||||
Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Albums: includeAlbums ? (albums ?? [.. _updateMusicArtistAlbumRequestFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicArtistRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicArtistRequest"/> instances.</returns>
|
||||
public List<UpdateMusicArtistRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicArtistTrackRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicArtistTrackRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = 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();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicArtistTrackRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track, when the track already exists.</param>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <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 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="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The references to the media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includeTrackId">Whether the track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePath">Whether the path 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="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number 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 key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the BPM 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="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="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>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UpdateMusicArtistTrackRequest"/> instance.</returns>
|
||||
public UpdateMusicArtistTrackRequest Create(
|
||||
Guid? trackId = null,
|
||||
string? path = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeTrackId = true,
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new UpdateMusicArtistTrackRequest(
|
||||
TrackId: includeTrackId ? (trackId ?? _faker.Random.Guid()) : null,
|
||||
Path: includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
Metadata: includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
TrackNumber: includeTrackNumber ? (trackNumber ?? _faker.Random.Number(1, 30)) : null,
|
||||
DiscNumber: includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 4)) : null,
|
||||
Script: includeScript ? (script ?? _faker.Lorem.Word()) : null,
|
||||
Key: includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
Bpm: includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null,
|
||||
Work: includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
MusicBrainzRecordingId: includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzTrackId: includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
Moods: includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Isrcs: includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicArtistTrackRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicArtistTrackRequest"/> instances.</returns>
|
||||
public List<UpdateMusicArtistTrackRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetAlbumTracksLiteRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetAlbumTracksLiteRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetAlbumTracksLiteRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="artistId">Optional Id of the artist the album belongs to.</param>
|
||||
/// <param name="albumId">Optional Id of the album whose tracks are retrieved.</param>
|
||||
/// <param name="libraryId">Optional Id of the media library the album belongs to.</param>
|
||||
/// <param name="currentPage">Optional page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional maximum number of tracks to retrieve per page.</param>
|
||||
/// <returns>A configured <see cref="GetAlbumTracksLiteRequest"/> instance.</returns>
|
||||
public GetAlbumTracksLiteRequest Create(
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
Guid? libraryId = null,
|
||||
int? currentPage = null,
|
||||
int? perPage = null)
|
||||
{
|
||||
return new GetAlbumTracksLiteRequest(
|
||||
ArtistId: artistId ?? Guid.NewGuid().ToString(),
|
||||
AlbumId: albumId ?? Guid.NewGuid().ToString(),
|
||||
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||
CurrentPage: currentPage,
|
||||
PerPage: perPage
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="GetAlbumTracksLiteRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetAlbumTracksLiteRequest"/> instances.</returns>
|
||||
public List<GetAlbumTracksLiteRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetMusicTrackViewRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetMusicTrackViewRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GetMusicTrackViewRequest"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="artistId">Optional unique identifier of the artist the album belongs to.</param>
|
||||
/// <param name="albumId">Optional unique identifier of the album the track belongs to.</param>
|
||||
/// <param name="trackId">Optional unique identifier of the track to retrieve.</param>
|
||||
/// <param name="libraryId">Optional unique identifier of the media library the track belongs to.</param>
|
||||
/// <returns>A configured <see cref="GetMusicTrackViewRequest"/> instance.</returns>
|
||||
public GetMusicTrackViewRequest Create(
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
string? trackId = null,
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetMusicTrackViewRequest(
|
||||
artistId ?? Guid.NewGuid().ToString(),
|
||||
albumId ?? Guid.NewGuid().ToString(),
|
||||
trackId ?? Guid.NewGuid().ToString(),
|
||||
libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetMusicTrackViewRequest"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetMusicTrackViewRequest"/> instances.</returns>
|
||||
public List<GetMusicTrackViewRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.DTO.MediaContributors;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateMusicTrackRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateMusicTrackRequestFixture
|
||||
{
|
||||
private readonly Faker _faker = 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();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UpdateMusicTrackRequest"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
/// <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 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="moods">Optional. The moods of the track.</param>
|
||||
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
|
||||
/// <param name="contributors">Optional. The references to the media contributors that performed on the track.</param>
|
||||
/// <param name="ratings">Optional. The ratings of the track.</param>
|
||||
/// <param name="includePath">Whether the path 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="includeTrackNumber">Whether the track number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDiscNumber">Whether the disc number 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 key should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBpm">Whether the BPM 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="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="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>
|
||||
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UpdateMusicTrackRequest"/> instance.</returns>
|
||||
public UpdateMusicTrackRequest Create(
|
||||
string? path = null,
|
||||
MusicTrackMetadataDto? metadata = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
string? script = null,
|
||||
MusicKey? key = null,
|
||||
int? bpm = null,
|
||||
MusicWorkDto? work = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
List<MoodDto>? moods = null,
|
||||
List<IsrcDto>? isrcs = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includePath = true,
|
||||
bool includeMetadata = true,
|
||||
bool includeTrackNumber = true,
|
||||
bool includeDiscNumber = true,
|
||||
bool includeScript = true,
|
||||
bool includeKey = true,
|
||||
bool includeBpm = true,
|
||||
bool includeWork = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeMoods = true,
|
||||
bool includeIsrcs = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true)
|
||||
{
|
||||
return new UpdateMusicTrackRequest(
|
||||
Path: includePath ? (path ?? _faker.System.FilePath()) : null,
|
||||
Metadata: includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
|
||||
TrackNumber: includeTrackNumber ? (trackNumber ?? _faker.Random.Number(1, 30)) : null,
|
||||
DiscNumber: includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 4)) : null,
|
||||
Script: includeScript ? (script ?? _faker.Lorem.Word()) : null,
|
||||
Key: includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
|
||||
Bpm: includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null,
|
||||
Work: includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
|
||||
MusicBrainzRecordingId: includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
MusicBrainzTrackId: includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
Moods: includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Isrcs: includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null,
|
||||
Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UpdateMusicTrackRequest"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="UpdateMusicTrackRequest"/> instances.</returns>
|
||||
public List<UpdateMusicTrackRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user