mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:13:42 +00:00
Renames project paths from Lumina to Nemera
This commit is contained in:
1 parent
ce6fddb4c9
commit
0f659a4877
6450 files changed
No files matched your search
+80
@@ -0,0 +1,80 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzAliasResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzAliasResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzAliasResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the alias.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="sortName">Optional. The sort name of the alias.</param>
|
||||
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="type">Optional. The type of the alias.</param>
|
||||
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="locale">Optional. The locale the alias is used in.</param>
|
||||
/// <param name="includeLocale">Whether the locale should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isPrimary">Optional. Whether this is the primary alias.</param>
|
||||
/// <param name="includePrimary">Whether the primary flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="begin">Optional. The begin date of the alias.</param>
|
||||
/// <param name="includeBegin">Whether the begin date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="end">Optional. The end date of the alias.</param>
|
||||
/// <param name="includeEnd">Whether the end date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isEnded">Optional. Whether the alias has ended.</param>
|
||||
/// <param name="includeEnded">Whether the ended flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzAliasResponse"/> instance.</returns>
|
||||
public MusicBrainzAliasResponse Create(
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? sortName = null,
|
||||
bool includeSortName = true,
|
||||
string? type = null,
|
||||
bool includeType = true,
|
||||
string? locale = null,
|
||||
bool includeLocale = true,
|
||||
bool? isPrimary = null,
|
||||
bool includePrimary = true,
|
||||
string? begin = null,
|
||||
bool includeBegin = true,
|
||||
string? end = null,
|
||||
bool includeEnd = true,
|
||||
bool? isEnded = null,
|
||||
bool includeEnded = true)
|
||||
{
|
||||
return new MusicBrainzAliasResponse
|
||||
{
|
||||
Name = includeName ? name ?? _faker.Name.FullName() : null,
|
||||
SortName = includeSortName ? sortName ?? _faker.Name.FullName() : null,
|
||||
Type = includeType ? type ?? _faker.PickRandom("Artist name", "Legal name") : null,
|
||||
Locale = includeLocale ? locale ?? _faker.PickRandom("en", "de", "fr") : null,
|
||||
IsPrimary = includePrimary ? isPrimary ?? _faker.Random.Bool() : null,
|
||||
Begin = includeBegin ? begin ?? _faker.Date.Past(50).ToString("yyyy-MM-dd") : null,
|
||||
End = includeEnd ? end ?? _faker.Date.Past(5).ToString("yyyy-MM-dd") : null,
|
||||
IsEnded = includeEnded ? isEnded ?? _faker.Random.Bool() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzAliasResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzAliasResponse"/> instances.</returns>
|
||||
public List<MusicBrainzAliasResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzAreaResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzAreaResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzAreaResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the area.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="name">Optional. The name of the area.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="sortName">Optional. The sort name of the area.</param>
|
||||
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the area.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="type">Optional. The MusicBrainz type of the area.</param>
|
||||
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="iso3166Part1Codes">Optional. The ISO 3166-1 codes of the area.</param>
|
||||
/// <param name="iso3166Part2Codes">Optional. The ISO 3166-2 codes of the area.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzAreaResponse"/> instance.</returns>
|
||||
public MusicBrainzAreaResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? sortName = null,
|
||||
bool includeSortName = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
string? type = null,
|
||||
bool includeType = true,
|
||||
List<string>? iso3166Part1Codes = null,
|
||||
List<string>? iso3166Part2Codes = null)
|
||||
{
|
||||
return new MusicBrainzAreaResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Name = includeName ? name ?? _faker.Address.Country() : null,
|
||||
SortName = includeSortName ? sortName ?? _faker.Address.Country() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Type = includeType ? type ?? _faker.PickRandom("Country", "City", "Area") : null,
|
||||
Iso3166Part1Codes = iso3166Part1Codes ?? [_faker.Address.CountryCode()],
|
||||
Iso3166Part2Codes = iso3166Part2Codes ?? [_faker.Random.String2(5, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzAreaResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzAreaResponse"/> instances.</returns>
|
||||
public List<MusicBrainzAreaResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzArtistCreditResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzArtistCreditResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzArtistResponseFixture _musicBrainzArtistResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzArtistCreditResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The credited name of the artist.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="joinPhrase">Optional. The join phrase that follows the credit.</param>
|
||||
/// <param name="includeJoinPhrase">Whether the join phrase should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="artist">Optional. The artist the credit refers to.</param>
|
||||
/// <param name="includeArtist">Whether the artist should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzArtistCreditResponse"/> instance.</returns>
|
||||
public MusicBrainzArtistCreditResponse Create(
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? joinPhrase = null,
|
||||
bool includeJoinPhrase = true,
|
||||
MusicBrainzArtistResponse? artist = null,
|
||||
bool includeArtist = true)
|
||||
{
|
||||
string? resolvedName = includeName ? name ?? _faker.Name.FullName() : null;
|
||||
return new MusicBrainzArtistCreditResponse
|
||||
{
|
||||
Name = resolvedName,
|
||||
JoinPhrase = includeJoinPhrase ? joinPhrase ?? _faker.PickRandom(" & ", " feat. ", ", ") : null,
|
||||
Artist = includeArtist ? artist ?? _musicBrainzArtistResponseFixture.Create(name: resolvedName) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzArtistCreditResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzArtistCreditResponse"/> instances.</returns>
|
||||
public List<MusicBrainzArtistCreditResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzArtistResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzArtistResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzAreaResponseFixture _musicBrainzAreaResponseFixture = new();
|
||||
private readonly MusicBrainzAliasResponseFixture _musicBrainzAliasResponseFixture = new();
|
||||
private readonly MusicBrainzRelationResponseFixture _musicBrainzRelationResponseFixture = new();
|
||||
private readonly MusicBrainzTagResponseFixture _musicBrainzTagResponseFixture = new();
|
||||
private readonly MusicBrainzLifeSpanResponseFixture _musicBrainzLifeSpanResponseFixture = new();
|
||||
private readonly MusicBrainzRatingResponseFixture _musicBrainzRatingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzArtistResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the artist.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="name">Optional. The name of the artist.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="sortName">Optional. The sort name of the artist.</param>
|
||||
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the artist.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="type">Optional. The MusicBrainz type of the artist.</param>
|
||||
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="gender">Optional. The gender of the artist.</param>
|
||||
/// <param name="includeGender">Whether the gender should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country of the artist.</param>
|
||||
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="area">Optional. The area the artist is primarily identified with.</param>
|
||||
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="beginArea">Optional. The area the artist began in.</param>
|
||||
/// <param name="includeBeginArea">Whether the begin area should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="endArea">Optional. The area the artist ended in.</param>
|
||||
/// <param name="includeEndArea">Whether the end area should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="lifeSpan">Optional. The life span of the artist.</param>
|
||||
/// <param name="includeLifeSpan">Whether the life span should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
|
||||
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
|
||||
/// <param name="aliases">Optional. The alternative names of the artist.</param>
|
||||
/// <param name="tags">Optional. The tags of the artist.</param>
|
||||
/// <param name="genres">Optional. The genres of the artist.</param>
|
||||
/// <param name="relations">Optional. The relationships of the artist to other entities.</param>
|
||||
/// <param name="rating">Optional. The aggregated rating of the artist.</param>
|
||||
/// <param name="includeRating">Whether the rating should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzArtistResponse"/> instance.</returns>
|
||||
public MusicBrainzArtistResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? sortName = null,
|
||||
bool includeSortName = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
string? type = null,
|
||||
bool includeType = true,
|
||||
string? gender = null,
|
||||
bool includeGender = true,
|
||||
string? country = null,
|
||||
bool includeCountry = true,
|
||||
MusicBrainzAreaResponse? area = null,
|
||||
bool includeArea = false,
|
||||
MusicBrainzAreaResponse? beginArea = null,
|
||||
bool includeBeginArea = false,
|
||||
MusicBrainzAreaResponse? endArea = null,
|
||||
bool includeEndArea = false,
|
||||
MusicBrainzLifeSpanResponse? lifeSpan = null,
|
||||
bool includeLifeSpan = false,
|
||||
List<string>? isnis = null,
|
||||
List<string>? ipis = null,
|
||||
List<MusicBrainzAliasResponse>? aliases = null,
|
||||
List<MusicBrainzTagResponse>? tags = null,
|
||||
List<MusicBrainzTagResponse>? genres = null,
|
||||
List<MusicBrainzRelationResponse>? relations = null,
|
||||
MusicBrainzRatingResponse? rating = null,
|
||||
bool includeRating = false)
|
||||
{
|
||||
return new MusicBrainzArtistResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Name = includeName ? name ?? _faker.Name.FullName() : null,
|
||||
SortName = includeSortName ? sortName ?? _faker.Name.FullName() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Type = includeType ? type ?? _faker.PickRandom("Person", "Group", "Orchestra") : null,
|
||||
Gender = includeGender ? gender ?? _faker.PickRandom("Male", "Female") : null,
|
||||
Country = includeCountry ? country ?? _faker.Address.CountryCode() : null,
|
||||
Area = includeArea ? area ?? _musicBrainzAreaResponseFixture.Create() : null,
|
||||
BeginArea = includeBeginArea ? beginArea ?? _musicBrainzAreaResponseFixture.Create() : null,
|
||||
EndArea = includeEndArea ? endArea ?? _musicBrainzAreaResponseFixture.Create() : null,
|
||||
LifeSpan = includeLifeSpan ? lifeSpan ?? _musicBrainzLifeSpanResponseFixture.Create() : null,
|
||||
Isnis = isnis ?? [_faker.Random.String2(16, "0123456789")],
|
||||
Ipis = ipis ?? [_faker.Random.String2(11, "0123456789")],
|
||||
Aliases = aliases ?? [.. _musicBrainzAliasResponseFixture.CreateMany(2)],
|
||||
Tags = tags ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Genres = genres ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Relations = relations ?? [.. _musicBrainzRelationResponseFixture.CreateMany(2)],
|
||||
Rating = includeRating ? rating ?? _musicBrainzRatingResponseFixture.Create() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzArtistResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzArtistResponse"/> instances.</returns>
|
||||
public List<MusicBrainzArtistResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzArtistSearchResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzArtistSearchResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzArtistResponseFixture _musicBrainzArtistResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzArtistSearchResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Optional. The total number of matching artists.</param>
|
||||
/// <param name="offset">Optional. The offset of the returned artists.</param>
|
||||
/// <param name="artists">Optional. The matching artists.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzArtistSearchResponse"/> instance.</returns>
|
||||
public MusicBrainzArtistSearchResponse Create(
|
||||
int? count = null,
|
||||
int? offset = null,
|
||||
List<MusicBrainzArtistResponse>? artists = null)
|
||||
{
|
||||
List<MusicBrainzArtistResponse> resolvedArtists = artists ?? [.. _musicBrainzArtistResponseFixture.CreateMany(2)];
|
||||
return new MusicBrainzArtistSearchResponse
|
||||
{
|
||||
Count = count ?? resolvedArtists.Count,
|
||||
Offset = offset ?? _faker.Random.Int(0, 100),
|
||||
Artists = resolvedArtists
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzArtistSearchResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzArtistSearchResponse"/> instances.</returns>
|
||||
public List<MusicBrainzArtistSearchResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzLabelInfoResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzLabelInfoResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzLabelResponseFixture _musicBrainzLabelResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzLabelInfoResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="catalogNumber">Optional. The catalog number assigned by the label.</param>
|
||||
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="label">Optional. The label that issued the release.</param>
|
||||
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzLabelInfoResponse"/> instance.</returns>
|
||||
public MusicBrainzLabelInfoResponse Create(
|
||||
string? catalogNumber = null,
|
||||
bool includeCatalogNumber = true,
|
||||
MusicBrainzLabelResponse? label = null,
|
||||
bool includeLabel = true)
|
||||
{
|
||||
return new MusicBrainzLabelInfoResponse
|
||||
{
|
||||
CatalogNumber = includeCatalogNumber ? catalogNumber ?? _faker.Random.AlphaNumeric(8).ToUpperInvariant() : null,
|
||||
Label = includeLabel ? label ?? _musicBrainzLabelResponseFixture.Create() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzLabelInfoResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzLabelInfoResponse"/> instances.</returns>
|
||||
public List<MusicBrainzLabelInfoResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzLabelResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzLabelResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzLabelResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the label.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="name">Optional. The name of the label.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the label.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="labelCode">Optional. The label code of the label.</param>
|
||||
/// <param name="includeLabelCode">Whether the label code should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzLabelResponse"/> instance.</returns>
|
||||
public MusicBrainzLabelResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
int? labelCode = null,
|
||||
bool includeLabelCode = true)
|
||||
{
|
||||
return new MusicBrainzLabelResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Name = includeName ? name ?? _faker.Company.CompanyName() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
LabelCode = includeLabelCode ? labelCode ?? _faker.Random.Int(1, 9999) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzLabelResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzLabelResponse"/> instances.</returns>
|
||||
public List<MusicBrainzLabelResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzLifeSpanResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzLifeSpanResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzLifeSpanResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="begin">Optional. The begin date of the life span.</param>
|
||||
/// <param name="includeBegin">Whether the begin date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="end">Optional. The end date of the life span.</param>
|
||||
/// <param name="includeEnd">Whether the end date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isEnded">Optional. Whether the life span has ended.</param>
|
||||
/// <param name="includeEnded">Whether the ended flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzLifeSpanResponse"/> instance.</returns>
|
||||
public MusicBrainzLifeSpanResponse Create(
|
||||
string? begin = null,
|
||||
bool includeBegin = true,
|
||||
string? end = null,
|
||||
bool includeEnd = true,
|
||||
bool? isEnded = null,
|
||||
bool includeEnded = true)
|
||||
{
|
||||
return new MusicBrainzLifeSpanResponse
|
||||
{
|
||||
Begin = includeBegin ? begin ?? _faker.Date.Past(60).ToString("yyyy-MM-dd") : null,
|
||||
End = includeEnd ? end ?? _faker.Date.Past(5).ToString("yyyy-MM-dd") : null,
|
||||
IsEnded = includeEnded ? isEnded ?? _faker.Random.Bool() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzLifeSpanResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzLifeSpanResponse"/> instances.</returns>
|
||||
public List<MusicBrainzLifeSpanResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzMediumResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzMediumResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzTrackResponseFixture _musicBrainzTrackResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzMediumResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="position">Optional. The position of the medium within its release.</param>
|
||||
/// <param name="title">Optional. The title of the medium.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="format">Optional. The format of the medium.</param>
|
||||
/// <param name="includeFormat">Whether the format should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="trackCount">Optional. The number of tracks of the medium.</param>
|
||||
/// <param name="tracks">Optional. The tracks of the medium.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzMediumResponse"/> instance.</returns>
|
||||
public MusicBrainzMediumResponse Create(
|
||||
int? position = null,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
string? format = null,
|
||||
bool includeFormat = true,
|
||||
int? trackCount = null,
|
||||
List<MusicBrainzTrackResponse>? tracks = null)
|
||||
{
|
||||
List<MusicBrainzTrackResponse> resolvedTracks = tracks ?? [.. _musicBrainzTrackResponseFixture.CreateMany(2)];
|
||||
return new MusicBrainzMediumResponse
|
||||
{
|
||||
Position = position ?? _faker.Random.Int(1, 4),
|
||||
Title = includeTitle ? title ?? _faker.Lorem.Sentence(2) : null,
|
||||
Format = includeFormat ? format ?? _faker.PickRandom("CD", "Vinyl", "Digital Media") : null,
|
||||
TrackCount = trackCount ?? resolvedTracks.Count,
|
||||
Tracks = resolvedTracks
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzMediumResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzMediumResponse"/> instances.</returns>
|
||||
public List<MusicBrainzMediumResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(index => Create(position: index + 1))];
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzRatingResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzRatingResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzRatingResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="value">Optional. The average rating value.</param>
|
||||
/// <param name="includeValue">Whether the value should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="votesCount">Optional. The number of votes that contributed to the rating.</param>
|
||||
/// <param name="includeVotesCount">Whether the votes count should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzRatingResponse"/> instance.</returns>
|
||||
public MusicBrainzRatingResponse Create(
|
||||
decimal? value = null,
|
||||
bool includeValue = true,
|
||||
int? votesCount = null,
|
||||
bool includeVotesCount = true)
|
||||
{
|
||||
return new MusicBrainzRatingResponse
|
||||
{
|
||||
Value = includeValue ? value ?? _faker.Random.Decimal(1m, 5m) : null,
|
||||
VotesCount = includeVotesCount ? votesCount ?? _faker.Random.Int(1, 500) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzRatingResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzRatingResponse"/> instances.</returns>
|
||||
public List<MusicBrainzRatingResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzRecordingListResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzRecordingListResponseFixture
|
||||
{
|
||||
private readonly MusicBrainzRecordingResponseFixture _musicBrainzRecordingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzRecordingListResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="recordings">Optional. The recordings that carry the looked up ISRC.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzRecordingListResponse"/> instance.</returns>
|
||||
public MusicBrainzRecordingListResponse Create(List<MusicBrainzRecordingResponse>? recordings = null)
|
||||
{
|
||||
return new MusicBrainzRecordingListResponse
|
||||
{
|
||||
Recordings = recordings ?? [.. _musicBrainzRecordingResponseFixture.CreateMany(2)]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzRecordingListResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzRecordingListResponse"/> instances.</returns>
|
||||
public List<MusicBrainzRecordingListResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzRecordingResponse"/> record.
|
||||
/// The releases of the recording default to an empty list, because a recording embedded in a release does not carry them.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzRecordingResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzArtistCreditResponseFixture _musicBrainzArtistCreditResponseFixture = new();
|
||||
private readonly MusicBrainzRelationResponseFixture _musicBrainzRelationResponseFixture = new();
|
||||
private readonly MusicBrainzTagResponseFixture _musicBrainzTagResponseFixture = new();
|
||||
private readonly MusicBrainzRatingResponseFixture _musicBrainzRatingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzRecordingResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="title">Optional. The title of the recording.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the recording.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="length">Optional. The length of the recording in milliseconds.</param>
|
||||
/// <param name="includeLength">Whether the length should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="isVideo">Optional. Whether the recording is a video recording.</param>
|
||||
/// <param name="includeVideo">Whether the video flag should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="firstReleaseDate">Optional. The date the recording was first released.</param>
|
||||
/// <param name="includeFirstReleaseDate">Whether the first release date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="artistCredit">Optional. The artist credit of the recording.</param>
|
||||
/// <param name="isrcs">Optional. The ISRCs of the recording.</param>
|
||||
/// <param name="releases">Optional. The releases the recording appears on.</param>
|
||||
/// <param name="tags">Optional. The tags of the recording.</param>
|
||||
/// <param name="genres">Optional. The genres of the recording.</param>
|
||||
/// <param name="relations">Optional. The relationships of the recording to other entities.</param>
|
||||
/// <param name="rating">Optional. The aggregated rating of the recording.</param>
|
||||
/// <param name="includeRating">Whether the rating should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzRecordingResponse"/> instance.</returns>
|
||||
public MusicBrainzRecordingResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
long? length = null,
|
||||
bool includeLength = true,
|
||||
bool? isVideo = null,
|
||||
bool includeVideo = true,
|
||||
string? firstReleaseDate = null,
|
||||
bool includeFirstReleaseDate = true,
|
||||
List<MusicBrainzArtistCreditResponse>? artistCredit = null,
|
||||
List<string>? isrcs = null,
|
||||
List<MusicBrainzReleaseResponse>? releases = null,
|
||||
List<MusicBrainzTagResponse>? tags = null,
|
||||
List<MusicBrainzTagResponse>? genres = null,
|
||||
List<MusicBrainzRelationResponse>? relations = null,
|
||||
MusicBrainzRatingResponse? rating = null,
|
||||
bool includeRating = false)
|
||||
{
|
||||
return new MusicBrainzRecordingResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Title = includeTitle ? title ?? _faker.Lorem.Sentence(3) : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Length = includeLength ? length ?? _faker.Random.Long(30_000, 600_000) : null,
|
||||
IsVideo = includeVideo ? isVideo ?? _faker.Random.Bool() : null,
|
||||
FirstReleaseDate = includeFirstReleaseDate ? firstReleaseDate ?? _faker.Date.Past(40).ToString("yyyy-MM-dd") : null,
|
||||
ArtistCredit = artistCredit ?? [.. _musicBrainzArtistCreditResponseFixture.CreateMany(2)],
|
||||
Isrcs = isrcs ?? [$"US{_faker.Random.AlphaNumeric(10).ToUpperInvariant()}"],
|
||||
Releases = releases ?? [],
|
||||
Tags = tags ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Genres = genres ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Relations = relations ?? [.. _musicBrainzRelationResponseFixture.CreateMany(2)],
|
||||
Rating = includeRating ? rating ?? _musicBrainzRatingResponseFixture.Create() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzRecordingResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzRecordingResponse"/> instances.</returns>
|
||||
public List<MusicBrainzRecordingResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzRecordingSearchResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzRecordingSearchResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzRecordingResponseFixture _musicBrainzRecordingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzRecordingSearchResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Optional. The total number of matching recordings.</param>
|
||||
/// <param name="offset">Optional. The offset of the returned recordings.</param>
|
||||
/// <param name="recordings">Optional. The matching recordings.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzRecordingSearchResponse"/> instance.</returns>
|
||||
public MusicBrainzRecordingSearchResponse Create(
|
||||
int? count = null,
|
||||
int? offset = null,
|
||||
List<MusicBrainzRecordingResponse>? recordings = null)
|
||||
{
|
||||
List<MusicBrainzRecordingResponse> resolvedRecordings = recordings ?? [.. _musicBrainzRecordingResponseFixture.CreateMany(2)];
|
||||
return new MusicBrainzRecordingSearchResponse
|
||||
{
|
||||
Count = count ?? resolvedRecordings.Count,
|
||||
Offset = offset ?? _faker.Random.Int(0, 100),
|
||||
Recordings = resolvedRecordings
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzRecordingSearchResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzRecordingSearchResponse"/> instances.</returns>
|
||||
public List<MusicBrainzRecordingSearchResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzRelationResponse"/> record.
|
||||
/// The nested artist, work and url targets are optional, because a relation usually targets only one of them.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzRelationResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
// The artist and work fixtures each compose a relation fixture of their own, so holding them eagerly here would recurse forever; they are
|
||||
// therefore created on first use. The URL fixture has no such dependency, so it is held directly.
|
||||
private readonly Lazy<MusicBrainzArtistResponseFixture> _musicBrainzArtistResponseFixture = new(() => new MusicBrainzArtistResponseFixture());
|
||||
private readonly Lazy<MusicBrainzWorkResponseFixture> _musicBrainzWorkResponseFixture = new(() => new MusicBrainzWorkResponseFixture());
|
||||
private readonly MusicBrainzUrlResponseFixture _musicBrainzUrlResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzRelationResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="type">Optional. The type of the relationship.</param>
|
||||
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="typeId">Optional. The MusicBrainz identifier of the type of the relationship.</param>
|
||||
/// <param name="includeTypeId">Whether the type identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="direction">Optional. The direction of the relationship.</param>
|
||||
/// <param name="includeDirection">Whether the direction should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="targetType">Optional. The type of the entity the relationship targets.</param>
|
||||
/// <param name="includeTargetType">Whether the target type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="artist">Optional. The artist the relationship targets.</param>
|
||||
/// <param name="includeArtist">Whether the artist should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="work">Optional. The work the relationship targets.</param>
|
||||
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="url">Optional. The URL the relationship targets.</param>
|
||||
/// <param name="includeUrl">Whether the URL should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="attributes">Optional. The attributes of the relationship.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzRelationResponse"/> instance.</returns>
|
||||
public MusicBrainzRelationResponse Create(
|
||||
string? type = null,
|
||||
bool includeType = true,
|
||||
string? typeId = null,
|
||||
bool includeTypeId = true,
|
||||
string? direction = null,
|
||||
bool includeDirection = true,
|
||||
string? targetType = null,
|
||||
bool includeTargetType = true,
|
||||
MusicBrainzArtistResponse? artist = null,
|
||||
bool includeArtist = false,
|
||||
MusicBrainzWorkResponse? work = null,
|
||||
bool includeWork = false,
|
||||
MusicBrainzUrlResponse? url = null,
|
||||
bool includeUrl = false,
|
||||
List<string>? attributes = null)
|
||||
{
|
||||
return new MusicBrainzRelationResponse
|
||||
{
|
||||
Type = includeType ? type ?? _faker.PickRandom("producer", "composer", "performer") : null,
|
||||
TypeId = includeTypeId ? typeId ?? Guid.NewGuid().ToString() : null,
|
||||
Direction = includeDirection ? direction ?? "backward" : null,
|
||||
TargetType = includeTargetType ? targetType ?? "artist" : null,
|
||||
Artist = includeArtist ? artist ?? _musicBrainzArtistResponseFixture.Value.Create() : null,
|
||||
Work = includeWork ? work ?? _musicBrainzWorkResponseFixture.Value.Create() : null,
|
||||
Url = includeUrl ? url ?? _musicBrainzUrlResponseFixture.Create() : null,
|
||||
Attributes = attributes ?? []
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzRelationResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzRelationResponse"/> instances.</returns>
|
||||
public List<MusicBrainzRelationResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzReleaseBrowseResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzReleaseBrowseResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzReleaseResponseFixture _musicBrainzReleaseResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzReleaseBrowseResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="releases">Optional. The releases returned by the browse request.</param>
|
||||
/// <param name="releaseCount">Optional. The total number of releases linked to the browsed entity.</param>
|
||||
/// <param name="releaseOffset">Optional. The offset of the returned releases.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzReleaseBrowseResponse"/> instance.</returns>
|
||||
public MusicBrainzReleaseBrowseResponse Create(
|
||||
List<MusicBrainzReleaseResponse>? releases = null,
|
||||
int? releaseCount = null,
|
||||
int? releaseOffset = null)
|
||||
{
|
||||
List<MusicBrainzReleaseResponse> resolvedReleases = releases ?? [.. _musicBrainzReleaseResponseFixture.CreateMany(2)];
|
||||
return new MusicBrainzReleaseBrowseResponse
|
||||
{
|
||||
Releases = resolvedReleases,
|
||||
ReleaseCount = releaseCount ?? resolvedReleases.Count,
|
||||
ReleaseOffset = releaseOffset ?? _faker.Random.Int(0, 100)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzReleaseBrowseResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzReleaseBrowseResponse"/> instances.</returns>
|
||||
public List<MusicBrainzReleaseBrowseResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzReleaseEventResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzReleaseEventResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzAreaResponseFixture _musicBrainzAreaResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzReleaseEventResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="date">Optional. The date of the release event.</param>
|
||||
/// <param name="includeDate">Whether the date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="area">Optional. The area of the release event.</param>
|
||||
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzReleaseEventResponse"/> instance.</returns>
|
||||
public MusicBrainzReleaseEventResponse Create(
|
||||
string? date = null,
|
||||
bool includeDate = true,
|
||||
MusicBrainzAreaResponse? area = null,
|
||||
bool includeArea = true)
|
||||
{
|
||||
return new MusicBrainzReleaseEventResponse
|
||||
{
|
||||
Date = includeDate ? date ?? _faker.Date.Past(40).ToString("yyyy-MM-dd") : null,
|
||||
Area = includeArea ? area ?? _musicBrainzAreaResponseFixture.Create() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzReleaseEventResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzReleaseEventResponse"/> instances.</returns>
|
||||
public List<MusicBrainzReleaseEventResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzReleaseGroupResponse"/> record.
|
||||
/// The releases of the release group default to an empty list, because they are only returned by a dedicated browse request.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzReleaseGroupResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzArtistCreditResponseFixture _musicBrainzArtistCreditResponseFixture = new();
|
||||
private readonly MusicBrainzTagResponseFixture _musicBrainzTagResponseFixture = new();
|
||||
private readonly MusicBrainzRatingResponseFixture _musicBrainzRatingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzReleaseGroupResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the release group.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="title">Optional. The title of the release group.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the release group.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="primaryType">Optional. The primary type of the release group.</param>
|
||||
/// <param name="includePrimaryType">Whether the primary type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="secondaryTypes">Optional. The secondary types of the release group.</param>
|
||||
/// <param name="firstReleaseDate">Optional. The date the release group was first released.</param>
|
||||
/// <param name="includeFirstReleaseDate">Whether the first release date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="artistCredit">Optional. The artist credit of the release group.</param>
|
||||
/// <param name="releases">Optional. The releases of the release group.</param>
|
||||
/// <param name="tags">Optional. The tags of the release group.</param>
|
||||
/// <param name="genres">Optional. The genres of the release group.</param>
|
||||
/// <param name="rating">Optional. The aggregated rating of the release group.</param>
|
||||
/// <param name="includeRating">Whether the rating should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzReleaseGroupResponse"/> instance.</returns>
|
||||
public MusicBrainzReleaseGroupResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
string? primaryType = null,
|
||||
bool includePrimaryType = true,
|
||||
List<string>? secondaryTypes = null,
|
||||
string? firstReleaseDate = null,
|
||||
bool includeFirstReleaseDate = true,
|
||||
List<MusicBrainzArtistCreditResponse>? artistCredit = null,
|
||||
List<MusicBrainzReleaseResponse>? releases = null,
|
||||
List<MusicBrainzTagResponse>? tags = null,
|
||||
List<MusicBrainzTagResponse>? genres = null,
|
||||
MusicBrainzRatingResponse? rating = null,
|
||||
bool includeRating = false)
|
||||
{
|
||||
return new MusicBrainzReleaseGroupResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Title = includeTitle ? title ?? _faker.Commerce.ProductName() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
PrimaryType = includePrimaryType ? primaryType ?? _faker.PickRandom("Album", "Single", "EP") : null,
|
||||
SecondaryTypes = secondaryTypes ?? [],
|
||||
FirstReleaseDate = includeFirstReleaseDate ? firstReleaseDate ?? _faker.Date.Past(40).ToString("yyyy-MM-dd") : null,
|
||||
ArtistCredit = artistCredit ?? [.. _musicBrainzArtistCreditResponseFixture.CreateMany(2)],
|
||||
Releases = releases ?? [],
|
||||
Tags = tags ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Genres = genres ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Rating = includeRating ? rating ?? _musicBrainzRatingResponseFixture.Create() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzReleaseGroupResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzReleaseGroupResponse"/> instances.</returns>
|
||||
public List<MusicBrainzReleaseGroupResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzReleaseGroupSearchResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzReleaseGroupSearchResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzReleaseGroupResponseFixture _musicBrainzReleaseGroupResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzReleaseGroupSearchResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Optional. The total number of matching release groups.</param>
|
||||
/// <param name="offset">Optional. The offset of the returned release groups.</param>
|
||||
/// <param name="releaseGroups">Optional. The matching release groups.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzReleaseGroupSearchResponse"/> instance.</returns>
|
||||
public MusicBrainzReleaseGroupSearchResponse Create(
|
||||
int? count = null,
|
||||
int? offset = null,
|
||||
List<MusicBrainzReleaseGroupResponse>? releaseGroups = null)
|
||||
{
|
||||
List<MusicBrainzReleaseGroupResponse> resolvedReleaseGroups = releaseGroups ?? [.. _musicBrainzReleaseGroupResponseFixture.CreateMany(2)];
|
||||
return new MusicBrainzReleaseGroupSearchResponse
|
||||
{
|
||||
Count = count ?? resolvedReleaseGroups.Count,
|
||||
Offset = offset ?? _faker.Random.Int(0, 100),
|
||||
ReleaseGroups = resolvedReleaseGroups
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzReleaseGroupSearchResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzReleaseGroupSearchResponse"/> instances.</returns>
|
||||
public List<MusicBrainzReleaseGroupSearchResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
#region ========================================================================= USING =====================================================================================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzReleaseResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzReleaseResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzArtistCreditResponseFixture _musicBrainzArtistCreditResponseFixture = new();
|
||||
private readonly MusicBrainzReleaseGroupResponseFixture _musicBrainzReleaseGroupResponseFixture = new();
|
||||
private readonly MusicBrainzLabelInfoResponseFixture _musicBrainzLabelInfoResponseFixture = new();
|
||||
private readonly MusicBrainzMediumResponseFixture _musicBrainzMediumResponseFixture = new();
|
||||
private readonly MusicBrainzReleaseEventResponseFixture _musicBrainzReleaseEventResponseFixture = new();
|
||||
private readonly MusicBrainzTagResponseFixture _musicBrainzTagResponseFixture = new();
|
||||
private readonly MusicBrainzTextRepresentationResponseFixture _musicBrainzTextRepresentationResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzReleaseResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the release.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="title">Optional. The title of the release.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the release.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="status">Optional. The status of the release.</param>
|
||||
/// <param name="includeStatus">Whether the status should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="date">Optional. The date the release was issued.</param>
|
||||
/// <param name="includeDate">Whether the date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country the release was issued in.</param>
|
||||
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="releaseEvents">Optional. The release events of the release.</param>
|
||||
/// <param name="barcode">Optional. The barcode of the release.</param>
|
||||
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="packaging">Optional. The outermost packaging of the release.</param>
|
||||
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="textRepresentation">Optional. The language and script of the titles of the release.</param>
|
||||
/// <param name="includeTextRepresentation">Whether the text representation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="artistCredit">Optional. The artist credit of the release.</param>
|
||||
/// <param name="releaseGroup">Optional. The release group the release belongs to.</param>
|
||||
/// <param name="includeReleaseGroup">Whether the release group should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="labelInfo">Optional. The label information of the release.</param>
|
||||
/// <param name="media">Optional. The media of the release.</param>
|
||||
/// <param name="asin">Optional. The ASIN of the release.</param>
|
||||
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="tags">Optional. The tags of the release.</param>
|
||||
/// <param name="genres">Optional. The genres of the release.</param>
|
||||
/// <param name="relations">Optional. The relationships of the release to other entities.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzReleaseResponse"/> instance.</returns>
|
||||
public MusicBrainzReleaseResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
string? status = null,
|
||||
bool includeStatus = true,
|
||||
string? date = null,
|
||||
bool includeDate = true,
|
||||
string? country = null,
|
||||
bool includeCountry = true,
|
||||
List<MusicBrainzReleaseEventResponse>? releaseEvents = null,
|
||||
string? barcode = null,
|
||||
bool includeBarcode = true,
|
||||
string? packaging = null,
|
||||
bool includePackaging = true,
|
||||
MusicBrainzTextRepresentationResponse? textRepresentation = null,
|
||||
bool includeTextRepresentation = true,
|
||||
List<MusicBrainzArtistCreditResponse>? artistCredit = null,
|
||||
MusicBrainzReleaseGroupResponse? releaseGroup = null,
|
||||
bool includeReleaseGroup = true,
|
||||
List<MusicBrainzLabelInfoResponse>? labelInfo = null,
|
||||
List<MusicBrainzMediumResponse>? media = null,
|
||||
string? asin = null,
|
||||
bool includeAsin = true,
|
||||
List<MusicBrainzTagResponse>? tags = null,
|
||||
List<MusicBrainzTagResponse>? genres = null,
|
||||
List<MusicBrainzRelationResponse>? relations = null)
|
||||
{
|
||||
return new MusicBrainzReleaseResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Title = includeTitle ? title ?? _faker.Commerce.ProductName() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Status = includeStatus ? status ?? _faker.PickRandom("Official", "Promotion", "Bootleg") : null,
|
||||
Date = includeDate ? date ?? _faker.Date.Past(40).ToString("yyyy-MM-dd") : null,
|
||||
Country = includeCountry ? country ?? _faker.Address.CountryCode() : null,
|
||||
ReleaseEvents = releaseEvents ?? [.. _musicBrainzReleaseEventResponseFixture.CreateMany(1)],
|
||||
Barcode = includeBarcode ? barcode ?? _faker.Random.AlphaNumeric(12) : null,
|
||||
Packaging = includePackaging ? packaging ?? _faker.PickRandom("Jewel Case", "Digipak") : null,
|
||||
TextRepresentation = includeTextRepresentation ? textRepresentation ?? _musicBrainzTextRepresentationResponseFixture.Create() : null,
|
||||
ArtistCredit = artistCredit ?? [.. _musicBrainzArtistCreditResponseFixture.CreateMany(2)],
|
||||
ReleaseGroup = includeReleaseGroup ? releaseGroup ?? _musicBrainzReleaseGroupResponseFixture.Create() : null,
|
||||
LabelInfo = labelInfo ?? [.. _musicBrainzLabelInfoResponseFixture.CreateMany(1)],
|
||||
Media = media ?? [.. _musicBrainzMediumResponseFixture.CreateMany(1)],
|
||||
Asin = includeAsin ? asin ?? _faker.Random.AlphaNumeric(10) : null,
|
||||
Tags = tags ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Genres = genres ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Relations = relations ?? []
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzReleaseResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzReleaseResponse"/> instances.</returns>
|
||||
public List<MusicBrainzReleaseResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzTagResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzTagResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzTagResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of a genre tag.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="name">Optional. The name of the tag.</param>
|
||||
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of a genre tag.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="count">Optional. The number of votes the tag received.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzTagResponse"/> instance.</returns>
|
||||
public MusicBrainzTagResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? name = null,
|
||||
bool includeName = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
int? count = null)
|
||||
{
|
||||
return new MusicBrainzTagResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Name = includeName ? name ?? _faker.Lorem.Word() : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Count = count ?? _faker.Random.Int(0, 100)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzTagResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzTagResponse"/> instances.</returns>
|
||||
public List<MusicBrainzTagResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzTextRepresentationResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzTextRepresentationResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzTextRepresentationResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="language">Optional. The ISO 639-3 language code of the release.</param>
|
||||
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="script">Optional. The ISO 15924 script code of the release.</param>
|
||||
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzTextRepresentationResponse"/> instance.</returns>
|
||||
public MusicBrainzTextRepresentationResponse Create(
|
||||
string? language = null,
|
||||
bool includeLanguage = true,
|
||||
string? script = null,
|
||||
bool includeScript = true)
|
||||
{
|
||||
return new MusicBrainzTextRepresentationResponse
|
||||
{
|
||||
Language = includeLanguage ? language ?? _faker.PickRandom("eng", "deu", "fra") : null,
|
||||
Script = includeScript ? script ?? _faker.PickRandom("Latn", "Cyrl", "Arab") : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzTextRepresentationResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzTextRepresentationResponse"/> instances.</returns>
|
||||
public List<MusicBrainzTextRepresentationResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzTrackResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzTrackResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzRecordingResponseFixture _musicBrainzRecordingResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzTrackResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the track.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="number">Optional. The track number, as displayed on the medium.</param>
|
||||
/// <param name="includeNumber">Whether the number should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="position">Optional. The position of the track within its medium.</param>
|
||||
/// <param name="title">Optional. The title of the track.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="length">Optional. The length of the track in milliseconds.</param>
|
||||
/// <param name="includeLength">Whether the length should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="recording">Optional. The recording the track is a performance of.</param>
|
||||
/// <param name="includeRecording">Whether the recording should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzTrackResponse"/> instance.</returns>
|
||||
public MusicBrainzTrackResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? number = null,
|
||||
bool includeNumber = true,
|
||||
int? position = null,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
long? length = null,
|
||||
bool includeLength = true,
|
||||
MusicBrainzRecordingResponse? recording = null,
|
||||
bool includeRecording = true)
|
||||
{
|
||||
int resolvedPosition = position ?? _faker.Random.Int(1, 30);
|
||||
string? resolvedTitle = includeTitle ? title ?? _faker.Lorem.Sentence(3) : null;
|
||||
return new MusicBrainzTrackResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Number = includeNumber ? number ?? resolvedPosition.ToString() : null,
|
||||
Position = resolvedPosition,
|
||||
Title = resolvedTitle,
|
||||
Length = includeLength ? length ?? _faker.Random.Long(30_000, 600_000) : null,
|
||||
Recording = includeRecording ? recording ?? _musicBrainzRecordingResponseFixture.Create(title: resolvedTitle) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzTrackResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzTrackResponse"/> instances.</returns>
|
||||
public List<MusicBrainzTrackResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(index => Create(position: index + 1))];
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzUrlResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzUrlResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzUrlResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the URL.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="resource">Optional. The resource the URL points to.</param>
|
||||
/// <param name="includeResource">Whether the resource should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzUrlResponse"/> instance.</returns>
|
||||
public MusicBrainzUrlResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? resource = null,
|
||||
bool includeResource = true)
|
||||
{
|
||||
return new MusicBrainzUrlResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Resource = includeResource ? resource ?? _faker.Internet.Url() : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzUrlResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzUrlResponse"/> instances.</returns>
|
||||
public List<MusicBrainzUrlResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.Contracts.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.Contracts.Responses;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzWorkResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzWorkResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly MusicBrainzRelationResponseFixture _musicBrainzRelationResponseFixture = new();
|
||||
private readonly MusicBrainzTagResponseFixture _musicBrainzTagResponseFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzWorkResponse"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="id">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="includeId">Whether the identifier should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="title">Optional. The title of the work.</param>
|
||||
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="type">Optional. The MusicBrainz type of the work.</param>
|
||||
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="disambiguation">Optional. The disambiguation comment of the work.</param>
|
||||
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="languages">Optional. The languages of the work.</param>
|
||||
/// <param name="iswcs">Optional. The ISWCs of the work.</param>
|
||||
/// <param name="relations">Optional. The relationships of the work to other entities.</param>
|
||||
/// <param name="tags">Optional. The tags of the work.</param>
|
||||
/// <param name="genres">Optional. The genres of the work.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzWorkResponse"/> instance.</returns>
|
||||
public MusicBrainzWorkResponse Create(
|
||||
string? id = null,
|
||||
bool includeId = true,
|
||||
string? title = null,
|
||||
bool includeTitle = true,
|
||||
string? type = null,
|
||||
bool includeType = true,
|
||||
string? disambiguation = null,
|
||||
bool includeDisambiguation = true,
|
||||
List<string>? languages = null,
|
||||
List<string>? iswcs = null,
|
||||
List<MusicBrainzRelationResponse>? relations = null,
|
||||
List<MusicBrainzTagResponse>? tags = null,
|
||||
List<MusicBrainzTagResponse>? genres = null)
|
||||
{
|
||||
return new MusicBrainzWorkResponse
|
||||
{
|
||||
Id = includeId ? id ?? Guid.NewGuid().ToString() : null,
|
||||
Title = includeTitle ? title ?? _faker.Lorem.Sentence(3) : null,
|
||||
Type = includeType ? type ?? _faker.PickRandom("Song", "Aria", "Symphony") : null,
|
||||
Disambiguation = includeDisambiguation ? disambiguation ?? _faker.Lorem.Sentence(2) : null,
|
||||
Languages = languages ?? [_faker.PickRandom("eng", "deu", "fra")],
|
||||
Iswcs = iswcs ?? [$"T-{_faker.Random.Int(100, 999)}.{_faker.Random.Int(100, 999)}.{_faker.Random.Int(100, 999)}-{_faker.Random.Int(1, 9)}"],
|
||||
Relations = relations ?? [.. _musicBrainzRelationResponseFixture.CreateMany(2)],
|
||||
Tags = tags ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)],
|
||||
Genres = genres ?? [.. _musicBrainzTagResponseFixture.CreateMany(2)]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzWorkResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzWorkResponse"/> instances.</returns>
|
||||
public List<MusicBrainzWorkResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Plugins.MusicBrainz.Common.Models.DTO.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.MusicBrainz.Fixtures.Common.Models.DTO.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="MusicBrainzSettingsDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed class MusicBrainzSettingsDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MusicBrainzSettingsDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="baseUrl">Optional. The base URL of the MusicBrainz web service.</param>
|
||||
/// <param name="doesAllowPrivateBaseUrl">Optional. Whether the base URL may point at a private or local host.</param>
|
||||
/// <param name="userAgent">Optional. The user agent sent with every request.</param>
|
||||
/// <param name="contactEmail">Optional. The contact email sent to the MusicBrainz API.</param>
|
||||
/// <param name="includeContactEmail">Whether the contact email should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="searchResultLimit">Optional. The maximum number of results returned by a single search.</param>
|
||||
/// <param name="releaseLookupLimit">Optional. The maximum number of releases fetched for a single release group.</param>
|
||||
/// <param name="minimumRequestInterval">Optional. The minimum interval between consecutive requests.</param>
|
||||
/// <returns>A configured <see cref="MusicBrainzSettingsDto"/> instance.</returns>
|
||||
public MusicBrainzSettingsDto Create(
|
||||
string? baseUrl = null,
|
||||
bool? doesAllowPrivateBaseUrl = null,
|
||||
string? userAgent = null,
|
||||
string? contactEmail = null,
|
||||
bool includeContactEmail = true,
|
||||
int? searchResultLimit = null,
|
||||
int? releaseLookupLimit = null,
|
||||
TimeSpan? minimumRequestInterval = null)
|
||||
{
|
||||
return new MusicBrainzSettingsDto
|
||||
{
|
||||
BaseUrl = baseUrl ?? _faker.Internet.Url(),
|
||||
DoesAllowPrivateBaseUrl = doesAllowPrivateBaseUrl ?? _faker.Random.Bool(),
|
||||
UserAgent = userAgent ?? $"Lumina-MusicBrainz/{_faker.Random.Int(1, 9)}.{_faker.Random.Int(0, 9)}",
|
||||
ContactEmail = includeContactEmail ? contactEmail ?? _faker.Internet.Email() : null,
|
||||
SearchResultLimit = searchResultLimit ?? _faker.Random.Int(1, 100),
|
||||
ReleaseLookupLimit = releaseLookupLimit ?? _faker.Random.Int(1, 100),
|
||||
MinimumRequestInterval = minimumRequestInterval ?? TimeSpan.FromSeconds(_faker.Random.Double(0, 5))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="MusicBrainzSettingsDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="MusicBrainzSettingsDto"/> instances.</returns>
|
||||
public List<MusicBrainzSettingsDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\api\</BaseOutputPath>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>false</IsTestProject>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoFixture" />
|
||||
<PackageReference Include="AutoFixture.AutoNSubstitute" />
|
||||
<PackageReference Include="AutoFixture.Xunit2" />
|
||||
<PackageReference Include="Bogus" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\plugins\Lumina.Plugins.MusicBrainz\Lumina.Plugins.MusicBrainz.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Lumina.Plugins.MusicBrainz.Fixtures")]
|
||||
[assembly: AssemblyProduct("Lumina.Plugins.MusicBrainz.Fixtures")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM.
|
||||
[assembly: Guid("C4D7E1A9-2F83-4B56-9E0D-6A8C1F3B5D72")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Lumina.Plugins.MusicBrainz.UnitTests")]
|
||||
[assembly: InternalsVisibleTo("Lumina.Plugins.MusicBrainz.SecurityTests")]
|
||||
[assembly: InternalsVisibleTo("Lumina.Plugins.MusicBrainz.IntegrationTests")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||
Reference in new issue
Block a user