mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Extends the music library listings with covers, sorting and alpha filtering.
This commit is contained in:
1 parent
0019821e87
commit
9d82f283e4
69 files changed
+3613
-268
No files matched your search
+21
-2
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -15,6 +16,9 @@ namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.Music
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AlbumLiteRowFixture
|
||||
{
|
||||
private const int MINIMUM_RELEASE_YEAR = 1900;
|
||||
private const int MAXIMUM_RELEASE_YEAR = 2026;
|
||||
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -23,17 +27,32 @@ public class AlbumLiteRowFixture
|
||||
/// <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>The created <see cref="AlbumLiteRow"/>.</returns>
|
||||
public AlbumLiteRow Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? totalTracks = 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 AlbumLiteRow
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Title = title ?? _faker.Music.Genre(),
|
||||
TotalTracks = totalTracks ?? _faker.Random.Int(1, 30)
|
||||
TotalTracks = totalTracks ?? _faker.Random.Int(1, 30),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
ReleaseYear = includeReleaseYear ? (releaseYear ?? _faker.Random.Int(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR)) : null,
|
||||
ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(index => _faker.PickRandom<MusicReleaseType>())]) : null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -22,15 +22,20 @@ public class ArtistLiteRowFixture
|
||||
/// </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>The created <see cref="ArtistLiteRow"/>.</returns>
|
||||
public ArtistLiteRow Create(
|
||||
Guid? id = null,
|
||||
string? name = null)
|
||||
string? name = null,
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new ArtistLiteRow
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Name = name ?? _faker.Name.FullName()
|
||||
Name = name ?? _faker.Name.FullName(),
|
||||
CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -25,20 +25,23 @@ public class TrackLiteRowFixture
|
||||
/// <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="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
|
||||
/// <returns>The created <see cref="TrackLiteRow"/>.</returns>
|
||||
public TrackLiteRow Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
bool includeDiscNumber = true)
|
||||
bool includeDiscNumber = true,
|
||||
int? durationInSeconds = null)
|
||||
{
|
||||
return new TrackLiteRow
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Title = title ?? _faker.Lorem.Sentence(),
|
||||
TrackNumber = trackNumber ?? _faker.Random.Int(1, 30),
|
||||
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null
|
||||
DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
DurationInSeconds = durationInSeconds ?? _faker.Random.Int(1, 600)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -3,6 +3,7 @@ using Bogus;
|
||||
using Lumina.Application.Common.DTO.Pagination;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite;
|
||||
using Lumina.Application.Fixtures.Common.DTO.Pagination;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -26,6 +27,10 @@ public class GetArtistsLiteQueryFixture
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose artists are retrieved, taken from the route.</param>
|
||||
/// <param name="paginationData">Optional. The pagination data of the query.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter the artists by name.</param>
|
||||
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The direction in which to sort the results.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePaginationData">Whether the pagination data 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>
|
||||
@@ -34,6 +39,10 @@ public class GetArtistsLiteQueryFixture
|
||||
string? libraryId = null,
|
||||
PaginationDataDto? paginationData = null,
|
||||
string? searchTerm = null,
|
||||
string? filterAlphaKey = null,
|
||||
bool shouldIgnoreThePrefixForAlphaPicker = false,
|
||||
string? sortBy = null,
|
||||
SortOrder? sortOrder = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includePaginationData = true,
|
||||
bool includeSearchTerm = true)
|
||||
@@ -41,7 +50,11 @@ public class GetArtistsLiteQueryFixture
|
||||
return new GetArtistsLiteQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null,
|
||||
filterAlphaKey,
|
||||
shouldIgnoreThePrefixForAlphaPicker,
|
||||
sortBy ?? _faker.Lorem.Word(),
|
||||
sortOrder ?? _faker.PickRandom<SortOrder>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MediaArtworkDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaArtworkDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="MediaArtworkDto"/>.
|
||||
/// </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>The created <see cref="MediaArtworkDto"/>.</returns>
|
||||
public MediaArtworkDto Create(
|
||||
ArtworkType? type = null,
|
||||
int? ordinal = null,
|
||||
string? path = null)
|
||||
{
|
||||
return new MediaArtworkDto(
|
||||
type ?? _faker.PickRandom<ArtworkType>(),
|
||||
ordinal ?? _faker.Random.Int(0, 5),
|
||||
path ?? _faker.System.FilePath());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="MediaArtworkDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<MediaArtworkDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+32
-2
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -22,22 +23,40 @@ public class GetArtistsLiteRequestFixture
|
||||
/// <param name="currentPage">Optional. The page of results to retrieve.</param>
|
||||
/// <param name="perPage">Optional. The maximum number of artists to retrieve per page.</param>
|
||||
/// <param name="searchTerm">Optional. The search term used to filter the artists by name.</param>
|
||||
/// <param name="filterAlphaKey">Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker.</param>
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not.</param>
|
||||
/// <param name="sortBy">Optional. The name of the field by which to sort the results.</param>
|
||||
/// <param name="sortOrder">Optional. The 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 filter 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>The created request to get the lightweight read models of the artists of a media library.</returns>
|
||||
public GetArtistsLiteRequest Create(
|
||||
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 includeSearchTerm = true,
|
||||
bool includeFilterAlphaKey = true,
|
||||
bool includeSortBy = true,
|
||||
bool includeSortOrder = true)
|
||||
{
|
||||
return new GetArtistsLiteRequest(
|
||||
includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null,
|
||||
includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null,
|
||||
includeFilterAlphaKey ? (filterAlphaKey ?? CreateFilterAlphaKey()) : null,
|
||||
shouldIgnoreThePrefixForAlphaPicker,
|
||||
includeSortBy ? (sortBy ?? _faker.Lorem.Word()) : null,
|
||||
includeSortOrder ? (sortOrder ?? _faker.PickRandom<SortOrder>()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,4 +68,15 @@ public class GetArtistsLiteRequestFixture
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid alpha key: a single ASCII letter, "#" for names starting with a digit, or "*" for any other first character.
|
||||
/// </summary>
|
||||
/// <returns>The created alpha key.</returns>
|
||||
private string CreateFilterAlphaKey()
|
||||
{
|
||||
return _faker.Random.Bool()
|
||||
? _faker.Random.Char('A', 'Z').ToString()
|
||||
: _faker.Random.ListItem(new[] { "#", "*" });
|
||||
}
|
||||
}
|
||||
+22
-2
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -23,16 +24,35 @@ public class AlbumLiteResponseFixture
|
||||
/// <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>The created <see cref="AlbumLiteResponse"/>.</returns>
|
||||
public AlbumLiteResponse Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? totalTracks = null)
|
||||
int? totalTracks = null,
|
||||
string? coverPath = null,
|
||||
int? releaseYear = null,
|
||||
List<MusicReleaseType>? releaseTypes = null,
|
||||
bool includeCoverPath = true,
|
||||
bool includeReleaseYear = true,
|
||||
bool includeReleaseTypes = true)
|
||||
{
|
||||
List<MusicReleaseType>? resolvedReleaseTypes = includeReleaseTypes
|
||||
? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(_ => _faker.PickRandom<MusicReleaseType>())])
|
||||
: null;
|
||||
|
||||
return new AlbumLiteResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
title ?? _faker.Commerce.ProductName(),
|
||||
totalTracks ?? _faker.Random.Int(1, 30));
|
||||
totalTracks ?? _faker.Random.Int(1, 30),
|
||||
includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
includeReleaseYear ? (releaseYear ?? _faker.Random.Int(1900, 2026)) : null,
|
||||
resolvedReleaseTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+19
-2
@@ -1,8 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
|
||||
@@ -29,6 +31,7 @@ public class AlbumResponseFixture
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
|
||||
private readonly TrackResponseFixture _trackResponseFixture = new();
|
||||
private readonly MediaArtworkDtoFixture _mediaArtworkDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="AlbumResponse"/>.
|
||||
@@ -51,6 +54,8 @@ public class AlbumResponseFixture
|
||||
/// <param name="contributors">Optional. The list of contributor references of the album.</param>
|
||||
/// <param name="ratings">Optional. The list of ratings of the album.</param>
|
||||
/// <param name="tracks">Optional. The list of tracks of the album.</param>
|
||||
/// <param name="coverPath">Optional. The path of the image representing the album.</param>
|
||||
/// <param name="artwork">Optional. The stored artwork of the album, in display order.</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>
|
||||
@@ -64,6 +69,8 @@ public class AlbumResponseFixture
|
||||
/// <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>
|
||||
/// <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 an empty collection.</param>
|
||||
/// <returns>The created <see cref="AlbumResponse"/>.</returns>
|
||||
public AlbumResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -84,6 +91,8 @@ public class AlbumResponseFixture
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
List<TrackResponse>? tracks = null,
|
||||
string? coverPath = null,
|
||||
List<MediaArtworkDto>? artwork = null,
|
||||
bool includeMediaFormat = true,
|
||||
bool includePackaging = true,
|
||||
bool includeBarcode = true,
|
||||
@@ -96,8 +105,14 @@ public class AlbumResponseFixture
|
||||
bool includeUpdatedOnUtc = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeTracks = true)
|
||||
bool includeTracks = true,
|
||||
bool includeCoverPath = true,
|
||||
bool includeArtwork = true)
|
||||
{
|
||||
IReadOnlyList<MediaArtworkDto> resolvedArtwork = includeArtwork
|
||||
? (artwork ?? _mediaArtworkDtoFixture.CreateMany(1))
|
||||
: [];
|
||||
|
||||
return new AlbumResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
artistId ?? Guid.NewGuid(),
|
||||
@@ -116,7 +131,9 @@ public class AlbumResponseFixture
|
||||
includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(1)) : null,
|
||||
includeTracks ? (tracks ?? _trackResponseFixture.CreateMany(1)) : null);
|
||||
includeTracks ? (tracks ?? _trackResponseFixture.CreateMany(1)) : null,
|
||||
includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null,
|
||||
resolvedArtwork);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+7
-2
@@ -22,14 +22,19 @@ public class ArtistLiteResponseFixture
|
||||
/// </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>The created <see cref="ArtistLiteResponse"/>.</returns>
|
||||
public ArtistLiteResponse Create(
|
||||
Guid? id = null,
|
||||
string? name = null)
|
||||
string? name = null,
|
||||
string? coverPath = null,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new ArtistLiteResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
name ?? _faker.Name.FullName());
|
||||
name ?? _faker.Name.FullName(),
|
||||
includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+7
-2
@@ -44,6 +44,7 @@ public class ArtistResponseFixture
|
||||
/// <param name="albums">Optional. The list of albums 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="coverPath">Optional. The path of the image representing the artist.</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>
|
||||
@@ -52,6 +53,7 @@ public class ArtistResponseFixture
|
||||
/// <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>
|
||||
/// <param name="includeCoverPath">Whether the cover path should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="ArtistResponse"/>.</returns>
|
||||
public ArtistResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -66,6 +68,7 @@ public class ArtistResponseFixture
|
||||
List<AlbumResponse>? albums = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
DateTime? updatedOnUtc = null,
|
||||
string? coverPath = null,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeIpis = true,
|
||||
@@ -73,7 +76,8 @@ public class ArtistResponseFixture
|
||||
bool includeUpdatedOnUtc = true,
|
||||
bool includeContributors = true,
|
||||
bool includeRatings = true,
|
||||
bool includeAlbums = true)
|
||||
bool includeAlbums = true,
|
||||
bool includeCoverPath = true)
|
||||
{
|
||||
return new ArtistResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
@@ -87,7 +91,8 @@ public class ArtistResponseFixture
|
||||
includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null,
|
||||
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null,
|
||||
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(1)) : null,
|
||||
includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null);
|
||||
includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null,
|
||||
includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+5
-2
@@ -25,19 +25,22 @@ public class TrackLiteResponseFixture
|
||||
/// <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="includeDiscNumber">Whether the disc number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
|
||||
/// <returns>The created <see cref="TrackLiteResponse"/>.</returns>
|
||||
public TrackLiteResponse Create(
|
||||
Guid? id = null,
|
||||
string? title = null,
|
||||
int? trackNumber = null,
|
||||
int? discNumber = null,
|
||||
bool includeDiscNumber = true)
|
||||
bool includeDiscNumber = true,
|
||||
int? durationInSeconds = null)
|
||||
{
|
||||
return new TrackLiteResponse(
|
||||
id ?? _faker.Random.Guid(),
|
||||
title ?? _faker.Lorem.Sentence(),
|
||||
trackNumber ?? _faker.Random.Int(1, 30),
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null);
|
||||
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
|
||||
durationInSeconds ?? _faker.Random.Int(1, 600));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user