Adds AddBook integration tests

This commit is contained in:
BinaryAlley committed 2024-09-01 11:21:26 +03:00
1 parent f37d06f8df
commit bd2880457c
20 files changed
+1544 -163

No files matched your search

@@ -87,22 +87,22 @@ public class BookMappingConfig : IRegister
Optional<string>.FromNullable(src.ReleaseCountry),
Optional<string>.FromNullable(src.ReleaseVersion)
).Value,
src.Genres.Select(g => Genre.Create(g.Name).Value).ToList(),
src.Tags.Select(t => Tag.Create(t.Name).Value).ToList(),
src.Genres.Select(g => Genre.Create(g.Name!).Value).ToList(),
src.Tags.Select(t => Tag.Create(t.Name!).Value).ToList(),
src.LanguageCode != null ? LanguageInfo.Create(
src.LanguageCode,
src.LanguageName,
src.LanguageName!,
Optional<string>.FromNullable(src.LanguageNativeName)
).Value : Optional<LanguageInfo>.None(),
src.OriginalLanguageCode != null ? LanguageInfo.Create(
src.OriginalLanguageCode,
src.OriginalLanguageName,
src.OriginalLanguageName!,
Optional<string>.FromNullable(src.OriginalLanguageNativeName)
).Value : Optional<LanguageInfo>.None(),
Optional<string>.FromNullable(src.Publisher),
Optional<int>.FromNullable(src.PageCount)
).Value,
Enum.Parse<BookFormat>(src.Format),
Optional<BookFormat>.FromNullable(!string.IsNullOrWhiteSpace(src.Format) ? Enum.Parse<BookFormat>(src.Format) : default),
Optional<string>.FromNullable(src.Edition),
Optional<int>.FromNullable(src.VolumeNumber),
Optional<BookSeries>.None(),
@@ -117,11 +117,11 @@ public class BookMappingConfig : IRegister
Optional<string>.FromNullable(src.AppleBooksId),
src.Created,
Optional<DateTime>.FromNullable(src.Updated),
src.ISBNs.Select(i => Isbn.Create(i.Value, i.Format).Value).ToList(),
src.ISBNs.Select(i => Isbn.Create(i.Value!, i.Format ?? default).Value).ToList(),
new List<MediaContributorId>(),
src.Ratings.Select(r => BookRating.Create(
r.Value,
r.MaxValue,
r.Value ?? default,
r.MaxValue ?? default,
Optional<BookRatingSource>.FromNullable(r.Source),
Optional<int>.FromNullable(r.VoteCount)
).Value).ToList()
@@ -9,8 +9,8 @@ namespace Lumina.Application.Common.Models.Books;
/// Represents a book rating.
/// </summary>
public record BookRatingDto(
decimal Value,
decimal MaxValue,
decimal? Value,
decimal? MaxValue,
BookRatingSource? Source,
int? VoteCount
) : RatingDto(Value, MaxValue, VoteCount);
@@ -4,5 +4,5 @@ namespace Lumina.Application.Common.Models.Books;
/// Represents a request to get book series information.
/// </summary>
public record BookSeriesDto(
string Title
string? Title
);
@@ -8,6 +8,6 @@ namespace Lumina.Application.Common.Models.Books;
/// Represents a request to get ISBN information.
/// </summary>
public record IsbnDto(
string Value,
IsbnFormat Format
string? Value,
IsbnFormat? Format
);
@@ -8,12 +8,12 @@ namespace Lumina.Application.Common.Models.Books;
/// Represents written content metadata.
/// </summary>
public record WrittenContentMetadataDto(
string Title,
string? Title,
string? OriginalTitle,
string? Description,
ReleaseInfoDto ReleaseInfo,
List<GenreDto> Genres,
List<TagDto> Tags,
ReleaseInfoDto? ReleaseInfo,
List<GenreDto>? Genres,
List<TagDto>? Tags,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
string? Publisher,
@@ -4,5 +4,5 @@ namespace Lumina.Application.Common.Models.Common;
/// Represents a request to get genre information.
/// </summary>
public record GenreDto(
string Name
string? Name
);
@@ -4,7 +4,7 @@ namespace Lumina.Application.Common.Models.Common;
/// Represents a request to get language information.
/// </summary>
public record LanguageInfoDto(
string LanguageCode,
string LanguageName,
string? LanguageCode,
string? LanguageName,
string? NativeName
);
@@ -4,7 +4,7 @@ namespace Lumina.Application.Common.Models.Common;
/// Represents a rating.
/// </summary>
public abstract record RatingDto(
decimal Value,
decimal MaxValue,
decimal? Value,
decimal? MaxValue,
int? VoteCount
);
@@ -4,5 +4,5 @@ namespace Lumina.Application.Common.Models.Common;
/// Represents a request to get tag information.
/// </summary>
public record TagDto(
string Name
string? Name
);
@@ -4,6 +4,6 @@ namespace Lumina.Application.Common.Models.Contributors;
/// Represents a media contributor.
/// </summary>
public record MediaContributorDto(
string Name,
MediaContributorRoleDto Role
string? Name,
MediaContributorRoleDto? Role
);
@@ -4,6 +4,6 @@ namespace Lumina.Application.Common.Models.Contributors;
/// Represents a media contributor role.
/// </summary>
public record MediaContributorRoleDto(
string Name,
string Category
string? Name,
string? Category
);