mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Adds domain Music aggregate
This commit is contained in:
1 parent
bde08c7440
commit
3a720af29f
100 files changed
+13077
-558
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -35,7 +36,7 @@ public class ReleaseInfoDtoFixture
|
||||
int? originalReleaseYear = null,
|
||||
DateOnly? reReleaseDate = null,
|
||||
int? reReleaseYear = null,
|
||||
string? releaseCountry = null,
|
||||
ReleaseCountry? releaseCountry = null,
|
||||
string? releaseVersion = null,
|
||||
bool includeOriginalReleaseDate = true,
|
||||
bool includeOriginalReleaseYear = true,
|
||||
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -97,7 +98,7 @@ public class BookMetadataDtoFixture
|
||||
releaseInfo ?? (includeOptionalProperties ? _releaseInfoDtoFixture.Create(
|
||||
originalReleaseDate: new DateOnly(releaseYear, 1, 1),
|
||||
originalReleaseYear: releaseYear,
|
||||
releaseCountry: _faker.Address.CountryCode()) : null),
|
||||
releaseCountry: _faker.PickRandom<ReleaseCountry>()) : null),
|
||||
genres ?? (includeOptionalProperties ? [_genreDtoFixture.Create()] : null),
|
||||
tags ?? (includeOptionalProperties ? [_tagDtoFixture.Create()] : null),
|
||||
language ?? (includeOptionalProperties ? _languageInfoDtoFixture.Create() : null),
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="BookSeriesDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class BookSeriesDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="BookSeriesDto"/> with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="title">Optional. The title of the book series.</param>
|
||||
/// <returns>A configured <see cref="BookSeriesDto"/> instance.</returns>
|
||||
public BookSeriesDto Create(string? title = null)
|
||||
{
|
||||
return new BookSeriesDto(title ?? _faker.Lorem.Sentence(3));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="BookSeriesDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="BookSeriesDto"/> instances.</returns>
|
||||
public List<BookSeriesDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+10
-8
@@ -1,8 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -22,6 +23,7 @@ public class WrittenContentMetadataDtoFixture
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="WrittenContentMetadataDto"/>.
|
||||
@@ -100,13 +102,13 @@ public class WrittenContentMetadataDtoFixture
|
||||
{
|
||||
int originalReleaseYear = _random.Next(1900, 2026);
|
||||
int reReleaseYear = _random.Next(originalReleaseYear, 2026);
|
||||
return new ReleaseInfoDto(
|
||||
new DateOnly(originalReleaseYear, 1, 1),
|
||||
originalReleaseYear,
|
||||
new DateOnly(reReleaseYear, 1, 1),
|
||||
reReleaseYear,
|
||||
_faker.Address.CountryCode(),
|
||||
_faker.Random.String2(_faker.Random.Number(1, 50)));
|
||||
return _releaseInfoDtoFixture.Create(
|
||||
originalReleaseDate: new DateOnly(originalReleaseYear, 1, 1),
|
||||
originalReleaseYear: originalReleaseYear,
|
||||
reReleaseDate: new DateOnly(reReleaseYear, 1, 1),
|
||||
reReleaseYear: reReleaseYear,
|
||||
releaseCountry: _faker.PickRandom<ReleaseCountry>(),
|
||||
releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+15
-27
@@ -1,12 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -22,6 +22,11 @@ namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.WrittenContentLi
|
||||
public class BookResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly WrittenContentMetadataDtoFixture _writtenContentMetadataDtoFixture = new();
|
||||
private readonly IsbnDtoFixture _isbnDtoFixture = new();
|
||||
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
|
||||
private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
|
||||
private readonly BookSeriesDtoFixture _bookSeriesDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="BookResponse"/>.
|
||||
@@ -33,6 +38,7 @@ public class BookResponseFixture
|
||||
/// <param name="format">Optional. The format of the book.</param>
|
||||
/// <param name="metadataStatus">Optional. The metadata enrichment status of the book.</param>
|
||||
/// <param name="createdOnUtc">Optional. The date and time when the book was created.</param>
|
||||
/// <param name="coverPath">Optional. The file system path of the cover image of the book.</param>
|
||||
/// <returns>The created <see cref="BookResponse"/>.</returns>
|
||||
public BookResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -49,11 +55,11 @@ public class BookResponseFixture
|
||||
id ?? Guid.NewGuid(),
|
||||
libraryId ?? Guid.NewGuid(),
|
||||
path ?? _faker.System.FilePath(),
|
||||
metadata ?? CreateMetadata(),
|
||||
metadata ?? _writtenContentMetadataDtoFixture.Create(),
|
||||
format ?? _faker.PickRandom<BookFormat>(),
|
||||
_faker.Lorem.Word(),
|
||||
_faker.Random.Int(1, 10),
|
||||
new BookSeriesDto(_faker.Lorem.Word()),
|
||||
_bookSeriesDtoFixture.Create(),
|
||||
_faker.Random.AlphaNumeric(10),
|
||||
_faker.Random.AlphaNumeric(5),
|
||||
_faker.Random.AlphaNumeric(8),
|
||||
@@ -63,11 +69,9 @@ public class BookResponseFixture
|
||||
_faker.Random.AlphaNumeric(6),
|
||||
_faker.Random.AlphaNumeric(10),
|
||||
_faker.Random.AlphaNumeric(8),
|
||||
[new IsbnDto(_faker.Random.Replace("###-#-##-#####-#"), IsbnFormat.Isbn13)],
|
||||
[new MediaContributorDto(
|
||||
new MediaContributorNameDto(_faker.Name.FullName(), _faker.Name.FullName()),
|
||||
new MediaContributorRoleDto(_faker.Commerce.ProductAdjective(), _faker.PickRandom<MediaContributorRoleCategory>()))],
|
||||
[new BookRatingDto(_faker.Random.Decimal(1m, 5m), 5m, BookRatingSource.Goodreads, _faker.Random.Int(1, 1000))],
|
||||
_isbnDtoFixture.CreateMany(1),
|
||||
_mediaContributorDtoFixture.CreateMany(1),
|
||||
_bookRatingDtoFixture.CreateMany(1),
|
||||
metadataStatus ?? _faker.PickRandom<MetadataStatus>(),
|
||||
_faker.Date.Recent().ToUniversalTime(),
|
||||
_faker.Company.CompanyName(),
|
||||
@@ -86,20 +90,4 @@ public class BookResponseFixture
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
|
||||
private WrittenContentMetadataDto CreateMetadata()
|
||||
{
|
||||
return new WrittenContentMetadataDto(
|
||||
_faker.Lorem.Sentence(3),
|
||||
_faker.Lorem.Sentence(3),
|
||||
_faker.Lorem.Paragraph(),
|
||||
new ReleaseInfoDto(_faker.Date.PastDateOnly(), _faker.Random.Int(1900, 2024), null, null, _faker.Address.CountryCode(), null),
|
||||
[new GenreDto(_faker.Lorem.Word())],
|
||||
[new TagDto(_faker.Lorem.Word())],
|
||||
new LanguageInfoDto("en", "English", "English"),
|
||||
null,
|
||||
_faker.Company.CompanyName(),
|
||||
_faker.Random.Int(100, 1000)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user