mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
Adapts the tests and fixtures to the refactored domain and persistence layers
This commit is contained in:
1 parent
e6f0c63feb
commit
ef913f5c9e
99 files changed
+612
-171
No files matched your search
+1
-6
@@ -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>
|
||||
|
||||
+3
-3
@@ -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,
|
||||
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -272,12 +272,12 @@ public class StubApiHttpClient : IApiHttpClient
|
||||
/// </summary>
|
||||
/// <typeparam name="TResponse">The expected type of the response content.</typeparam>
|
||||
/// <param name="endpoint">The API endpoint where the request is being sent.</param>
|
||||
/// <param name="fileStream">The stream of the file to upload.</param>
|
||||
/// <param name="fileName">The name of the file to upload.</param>
|
||||
/// <param name="fileStream">The stream of the file to upload, or <see langword="null"/> when no file is uploaded.</param>
|
||||
/// <param name="fileName">The name of the file to upload, or <see langword="null"/> when no file is uploaded.</param>
|
||||
/// <param name="fieldName">The name of the form field carrying the file.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The deserialized response containing the result of the PUT request.</returns>
|
||||
public Task<TResponse> PutMultipartAsync<TResponse>(string endpoint, Stream fileStream, string fileName, string fieldName, CancellationToken cancellationToken = default)
|
||||
public Task<TResponse> PutMultipartAsync<TResponse>(string endpoint, Stream? fileStream, string? fileName, string fieldName, CancellationToken cancellationToken = default)
|
||||
{
|
||||
PutRequests.Add((endpoint, fileName));
|
||||
if (_putResponseFactories.TryGetValue(endpoint, out Func<object, object>? responseFactory))
|
||||
|
||||
Reference in new issue
Block a user