Adapts the tests and fixtures to the refactored domain and persistence layers

This commit is contained in:
BinaryAlley committed 2026-09-20 01:35:14 +03:00
1 parent e6f0c63feb
commit ef913f5c9e
99 files changed
+612 -171

No files matched your search

@@ -2,7 +2,6 @@
using Bogus;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Common.ValueObjects.Metadata;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -32,14 +31,10 @@ public class LanguageInfoFixture
{
string[] languages = ["en", "es", "fr", "de", "it", "ja", "ko", "zh", "pt", "ru"];
Result<LanguageInfo> languageInfoResult = LanguageInfo.Create(
return LanguageInfo.Create(
languageCode ?? _faker.PickRandom(languages),
languageName ?? _faker.Lorem.Word(),
nativeName ?? Optional<string>.Some(_faker.Lorem.Word()));
if (languageInfoResult.IsFailure)
throw new InvalidOperationException("Failed to create LanguageInfo: " + string.Join(", ", languageInfoResult.Errors));
return languageInfoResult.Value;
}
/// <summary>
@@ -37,7 +37,7 @@ public class LibraryFixture
/// <param name="libraryType">Optional. The library type.</param>
/// <param name="contentLocations">Optional. The content locations of the library.</param>
/// <param name="coverImage">Optional. The cover image of the library.</param>
/// <param name="includeCoverImage">Whether the cover image should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCoverImage">Whether the cover image should be included, or left unset, meaning the library has no cover.</param>
/// <param name="isEnabled">Whether the library is enabled.</param>
/// <param name="isLocked">Whether the library is locked.</param>
/// <param name="canDownloadMetadataFromWeb">Whether metadata download from the web is enabled.</param>
@@ -78,7 +78,7 @@ public class LibraryFixture
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? _faker.PickRandom<LibraryType>(),
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
resolvedCoverImage,
Optional<string>.FromNullable(resolvedCoverImage),
isEnabled,
isLocked,
canDownloadMetadataFromWeb,
@@ -92,7 +92,7 @@ public class LibraryFixture
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? _faker.PickRandom<LibraryType>(),
contentLocations ?? validPaths.Take(_random.Next(1, validPaths.Count)),
resolvedCoverImage,
Optional<string>.FromNullable(resolvedCoverImage),
isEnabled,
isLocked,
canDownloadMetadataFromWeb,
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
@@ -44,6 +45,6 @@ public class LibraryScanFailedDomainEventFixture
libraryId ?? _libraryIdFixture.Create(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow,
includeErrorMessage ? (errorMessage ?? _faker.Random.Words()) : null);
Optional<string>.FromNullable(includeErrorMessage ? (errorMessage ?? _faker.Random.Words()) : null));
}
}