mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Adds the music library artist test suite
This commit is contained in:
1 parent
5d3e430dd1
commit
e73b3997bc
77 files changed
+20974
-15
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ArtistLiteRow"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ArtistLiteRowFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ArtistLiteRow"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The Id of the artist.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <returns>The created <see cref="ArtistLiteRow"/>.</returns>
|
||||
public ArtistLiteRow Create(
|
||||
Guid? id = null,
|
||||
string? name = null)
|
||||
{
|
||||
return new ArtistLiteRow
|
||||
{
|
||||
Id = id ?? _faker.Random.Guid(),
|
||||
Name = name ?? _faker.Name.FullName()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ArtistLiteRow"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ArtistLiteRow"/> instances.</returns>
|
||||
public List<ArtistLiteRow> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -24,8 +24,12 @@ public class ArtistEntityFixture
|
||||
/// <param name="id">Optional. The Id of the artist.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library that owns the artist.</param>
|
||||
/// <param name="name">Optional. The name 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="albums">Optional. The albums of the artist.</param>
|
||||
/// <param name="includeAlbums">Whether the artist should own a generated album, or no album at all.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the artist should own a generated media contributor, or none at all.</param>
|
||||
/// <param name="includeMetadata">Whether the owned metadata collections of the generated album should be included, or forced to empty collections.</param>
|
||||
/// <returns>The created <see cref="ArtistEntity"/>.</returns>
|
||||
@@ -33,8 +37,12 @@ public class ArtistEntityFixture
|
||||
Guid? id = null,
|
||||
Guid? libraryId = null,
|
||||
string? name = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<AlbumEntity>? albums = null,
|
||||
bool includeAlbums = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeContributors = true,
|
||||
bool includeMetadata = true)
|
||||
{
|
||||
@@ -53,8 +61,8 @@ public class ArtistEntityFixture
|
||||
UpdatedBy = null
|
||||
})
|
||||
.RuleFor(x => x.Name, f => name ?? f.Name.FullName())
|
||||
.RuleFor(x => x.Website, f => f.Internet.Url())
|
||||
.RuleFor(x => x.MusicBrainzArtistId, f => f.Random.Guid())
|
||||
.RuleFor(x => x.Website, f => includeWebsite ? (website ?? f.Internet.Url()) : null)
|
||||
.RuleFor(x => x.MusicBrainzArtistId, f => includeMusicBrainzArtistId ? (musicBrainzArtistId ?? f.Random.Guid()) : null)
|
||||
.RuleFor(x => x.Albums, resolvedAlbums)
|
||||
.RuleFor(x => x.Contributors, f => includeContributors ? _artistContributorEntityFixture.CreateMany(f.Random.Number(1, 3), artistId: resolvedId) : [])
|
||||
.RuleFor(x => x.CreatedOnUtc, f => f.Date.Past())
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.AddArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.AddArtist;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="AddArtistCommand"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to add an artist.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to add an artist.</returns>
|
||||
public AddArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? name = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeName = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeContributors = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
|
||||
return new AddArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="AddArtistCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<AddArtistCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the albums of the artist, tied to the artist's library identifier.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library the albums belong to.</param>
|
||||
/// <returns>The generated albums.</returns>
|
||||
private List<AddAlbumCommand> GenerateAlbums(string? libraryId)
|
||||
{
|
||||
return [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(_ => _addAlbumCommandFixture.Create(libraryId: libraryId))];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.DeleteArtist;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.DeleteArtist;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="DeleteArtistCommand"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteArtistCommandFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="DeleteArtistCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist to delete, taken from the route.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="DeleteArtistCommand"/>.</returns>
|
||||
public DeleteArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true)
|
||||
{
|
||||
return new DeleteArtistCommand(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="DeleteArtistCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="DeleteArtistCommand"/> instances.</returns>
|
||||
public List<DeleteArtistCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtist;
|
||||
using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.AddAlbum;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtist;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="UpdateArtistCommand"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateArtistCommandFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly AddAlbumCommandFixture _addAlbumCommandFixture = new();
|
||||
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid command to update an artist.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist, taken from the route.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="website">Optional. The website of the artist.</param>
|
||||
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
|
||||
/// <param name="albums">Optional. The albums of the artist, each with its own tracks.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created command to update an artist.</returns>
|
||||
public UpdateArtistCommand Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? name = null,
|
||||
string? website = null,
|
||||
Guid? musicBrainzArtistId = null,
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AddAlbumCommand>? albums = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includeName = true,
|
||||
bool includeWebsite = true,
|
||||
bool includeMusicBrainzArtistId = true,
|
||||
bool includeContributors = true,
|
||||
bool includeAlbums = true)
|
||||
{
|
||||
string? resolvedLibraryId = includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null;
|
||||
|
||||
return new UpdateArtistCommand(
|
||||
resolvedLibraryId,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeName ? (name ?? _faker.Name.FullName()) : null,
|
||||
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
|
||||
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null,
|
||||
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
|
||||
includeAlbums ? (albums ?? GenerateAlbums(resolvedLibraryId)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="UpdateArtistCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<UpdateArtistCommand> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the albums of the artist, tied to the artist's library identifier.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the media library the albums belong to.</param>
|
||||
/// <returns>The generated albums.</returns>
|
||||
private List<AddAlbumCommand> GenerateAlbums(string? libraryId)
|
||||
{
|
||||
return [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(_ => _addAlbumCommandFixture.Create(libraryId: libraryId))];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtist;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtist;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetArtistQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist to get, taken from the route.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetArtistQuery"/>.</returns>
|
||||
public GetArtistQuery Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true)
|
||||
{
|
||||
return new GetArtistQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistQuery"/> instances.</returns>
|
||||
public List<GetArtistQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistAlbums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistAlbums;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistAlbumsQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistAlbumsQueryFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetArtistAlbumsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist whose albums are retrieved, taken from the route.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetArtistAlbumsQuery"/>.</returns>
|
||||
public GetArtistAlbumsQuery Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true)
|
||||
{
|
||||
return new GetArtistAlbumsQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistAlbumsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistAlbumsQuery"/> instances.</returns>
|
||||
public List<GetArtistAlbumsQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.Pagination;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistAlbumsLite;
|
||||
using Lumina.Application.Fixtures.Common.DTO.Pagination;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistAlbumsLite;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistAlbumsLiteQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistAlbumsLiteQueryFixture
|
||||
{
|
||||
private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetArtistAlbumsLiteQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to, taken from the route.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist whose albums are retrieved, taken from the route.</param>
|
||||
/// <param name="paginationData">Optional. The pagination data of the query.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includePaginationData">Whether the pagination data should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetArtistAlbumsLiteQuery"/>.</returns>
|
||||
public GetArtistAlbumsLiteQuery Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
PaginationDataDto? paginationData = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includePaginationData = true)
|
||||
{
|
||||
return new GetArtistAlbumsLiteQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistAlbumsLiteQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistAlbumsLiteQuery"/> instances.</returns>
|
||||
public List<GetArtistAlbumsLiteQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.Pagination;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtists;
|
||||
using Lumina.Application.Fixtures.Common.DTO.Pagination;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtists;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistsQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistsQueryFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetArtistsQuery"/>.
|
||||
/// </summary>
|
||||
/// <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="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>
|
||||
/// <returns>The created <see cref="GetArtistsQuery"/>.</returns>
|
||||
public GetArtistsQuery Create(
|
||||
string? libraryId = null,
|
||||
PaginationDataDto? paginationData = null,
|
||||
string? searchTerm = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includePaginationData = true,
|
||||
bool includeSearchTerm = true)
|
||||
{
|
||||
return new GetArtistsQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistsQuery"/> instances.</returns>
|
||||
public List<GetArtistsQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetArtistsLiteQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetArtistsLiteQueryFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetArtistsLiteQuery"/>.
|
||||
/// </summary>
|
||||
/// <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="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>
|
||||
/// <returns>The created <see cref="GetArtistsLiteQuery"/>.</returns>
|
||||
public GetArtistsLiteQuery Create(
|
||||
string? libraryId = null,
|
||||
PaginationDataDto? paginationData = null,
|
||||
string? searchTerm = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includePaginationData = true,
|
||||
bool includeSearchTerm = true)
|
||||
{
|
||||
return new GetArtistsLiteQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null,
|
||||
includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetArtistsLiteQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetArtistsLiteQuery"/> instances.</returns>
|
||||
public List<GetArtistsLiteQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user