mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Adds tests for the book reading feature
This commit is contained in:
1 parent
f7ccdf3d1c
commit
3a3c0c047c
192 files changed
+14104
-342
No files matched your search
+49
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="LibraryBookReaderDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LibraryBookReaderDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="LibraryBookReaderDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">Optional unique identifier of the plugin providing the book reader.</param>
|
||||
/// <param name="name">Optional display name of the book reader.</param>
|
||||
/// <param name="supportedExtensions">Optional file extensions supported by the book reader.</param>
|
||||
/// <param name="isEnabled">Optional value indicating whether the book reader is enabled for the media library.</param>
|
||||
/// <returns>A configured <see cref="LibraryBookReaderDto"/> instance.</returns>
|
||||
public LibraryBookReaderDto Create(
|
||||
Guid? pluginId = null,
|
||||
string? name = null,
|
||||
List<string>? supportedExtensions = null,
|
||||
bool? isEnabled = null)
|
||||
{
|
||||
return new LibraryBookReaderDto
|
||||
{
|
||||
PluginId = pluginId ?? Guid.NewGuid(),
|
||||
Name = name ?? $"Reader {Guid.NewGuid():N}",
|
||||
SupportedExtensions = supportedExtensions ?? [".epub", ".pdf"],
|
||||
IsEnabled = isEnabled ?? true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="LibraryBookReaderDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="LibraryBookReaderDto"/> instances.</returns>
|
||||
public List<LibraryBookReaderDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ReadingAvailabilityDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadingAvailabilityDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadingAvailabilityDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional identifier of the book whose reading availability is reported.</param>
|
||||
/// <param name="libraryId">Optional identifier of the media library the book belongs to.</param>
|
||||
/// <param name="isAvailable">Optional value indicating whether the book can be opened for reading.</param>
|
||||
/// <param name="errorCode">Optional code of the error preventing the book from being read, when it cannot be read.</param>
|
||||
/// <returns>A configured <see cref="ReadingAvailabilityDto"/> instance.</returns>
|
||||
public ReadingAvailabilityDto Create(
|
||||
Guid? bookId = null,
|
||||
Guid? libraryId = null,
|
||||
bool? isAvailable = null,
|
||||
string? errorCode = null)
|
||||
{
|
||||
return new ReadingAvailabilityDto
|
||||
{
|
||||
BookId = bookId ?? Guid.NewGuid(),
|
||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
||||
IsAvailable = isAvailable ?? true,
|
||||
ErrorCode = errorCode
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ReadingAvailabilityDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReadingAvailabilityDto"/> instances.</returns>
|
||||
public List<ReadingAvailabilityDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ReadingManifestDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadingManifestDtoFixture
|
||||
{
|
||||
private readonly ReadingTocEntryDtoFixture _readingTocEntryDtoFixture = new();
|
||||
private readonly ReadingSpineItemDtoFixture _readingSpineItemDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadingManifestDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="title">Optional title of the book.</param>
|
||||
/// <param name="author">Optional author of the book.</param>
|
||||
/// <param name="coverResourceKey">Optional resource key of the cover image of the book.</param>
|
||||
/// <param name="tableOfContents">Optional hierarchical table of contents of the book.</param>
|
||||
/// <param name="spine">Optional ordered spine of the reading sections of the book.</param>
|
||||
/// <param name="resourceKeys">Optional resource keys of the resources of the book.</param>
|
||||
/// <param name="hasTextContent">Optional value indicating whether the book has extractable text content.</param>
|
||||
/// <returns>A configured <see cref="ReadingManifestDto"/> instance.</returns>
|
||||
public ReadingManifestDto Create(
|
||||
string? title = null,
|
||||
string? author = null,
|
||||
string? coverResourceKey = null,
|
||||
List<ReadingTocEntryDto>? tableOfContents = null,
|
||||
List<ReadingSpineItemDto>? spine = null,
|
||||
List<string>? resourceKeys = null,
|
||||
bool? hasTextContent = null)
|
||||
{
|
||||
return new ReadingManifestDto
|
||||
{
|
||||
Title = title ?? $"Book {Guid.NewGuid():N}",
|
||||
Author = author,
|
||||
CoverResourceKey = coverResourceKey,
|
||||
TableOfContents = tableOfContents ?? [.. _readingTocEntryDtoFixture.CreateMany(2)],
|
||||
Spine = spine ?? [.. _readingSpineItemDtoFixture.CreateMany(2)],
|
||||
ResourceKeys = resourceKeys ?? [.. Enumerable.Range(0, 2).Select(_ => $"resource-{Guid.NewGuid():N}")],
|
||||
HasTextContent = hasTextContent ?? true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ReadingManifestDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReadingManifestDto"/> instances.</returns>
|
||||
public List<ReadingManifestDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ReadingSectionDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadingSectionDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadingSectionDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="locationRef">Optional opaque location reference of the reading section.</param>
|
||||
/// <param name="title">Optional title of the reading section.</param>
|
||||
/// <param name="contentHtml">Optional sanitized HTML content of the reading section.</param>
|
||||
/// <returns>A configured <see cref="ReadingSectionDto"/> instance.</returns>
|
||||
public ReadingSectionDto Create(
|
||||
string? locationRef = null,
|
||||
string? title = null,
|
||||
string? contentHtml = null)
|
||||
{
|
||||
return new ReadingSectionDto
|
||||
{
|
||||
LocationRef = locationRef ?? $"section-{Guid.NewGuid():N}",
|
||||
Title = title,
|
||||
ContentHtml = contentHtml ?? "<section><p>Content</p></section>"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ReadingSectionDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReadingSectionDto"/> instances.</returns>
|
||||
public List<ReadingSectionDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ReadingSpineItemDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadingSpineItemDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadingSpineItemDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="locationRef">Optional opaque location reference of the reading section.</param>
|
||||
/// <param name="title">Optional title of the reading section.</param>
|
||||
/// <returns>A configured <see cref="ReadingSpineItemDto"/> instance.</returns>
|
||||
public ReadingSpineItemDto Create(
|
||||
string? locationRef = null,
|
||||
string? title = null)
|
||||
{
|
||||
return new ReadingSpineItemDto
|
||||
{
|
||||
LocationRef = locationRef ?? $"section-{Guid.NewGuid():N}",
|
||||
Title = title
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ReadingSpineItemDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReadingSpineItemDto"/> instances.</returns>
|
||||
public List<ReadingSpineItemDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.DTO.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="ReadingTocEntryDto"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadingTocEntryDtoFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadingTocEntryDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="label">Optional label of the table of contents entry.</param>
|
||||
/// <param name="locationRef">Optional opaque location reference of the reading section the entry points to.</param>
|
||||
/// <param name="children">Optional child entries of the table of contents entry.</param>
|
||||
/// <returns>A configured <see cref="ReadingTocEntryDto"/> instance.</returns>
|
||||
public ReadingTocEntryDto Create(
|
||||
string? label = null,
|
||||
string? locationRef = null,
|
||||
List<ReadingTocEntryDto>? children = null)
|
||||
{
|
||||
return new ReadingTocEntryDto
|
||||
{
|
||||
Label = label ?? $"Chapter {Guid.NewGuid():N}",
|
||||
LocationRef = locationRef ?? $"section-{Guid.NewGuid():N}",
|
||||
Children = children ?? []
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="ReadingTocEntryDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="ReadingTocEntryDto"/> instances.</returns>
|
||||
public List<ReadingTocEntryDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+8
-2
@@ -26,6 +26,8 @@ public class UserSettingsDtoFixture
|
||||
/// <param name="shouldIgnoreThePrefixForAlphaPicker">Whether the "The" prefix is ignored by the alpha picker.</param>
|
||||
/// <param name="isThemeCachingEnabled">Whether the theme data served to this user is cached.</param>
|
||||
/// <param name="shouldAggregateMetadataWhenMissing">Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing.</param>
|
||||
/// <param name="shouldRenderPdfAsImages">Whether PDF books are rendered as page images for the user.</param>
|
||||
/// <param name="shouldPreserveBookStyles">Whether the styles of the book content are preserved when it is rendered for the user.</param>
|
||||
/// <returns>A configured <see cref="UserSettingsDto"/> instance.</returns>
|
||||
public UserSettingsDto Create(
|
||||
Guid? userId = null,
|
||||
@@ -33,7 +35,9 @@ public class UserSettingsDtoFixture
|
||||
int? itemsPerPage = null,
|
||||
bool? shouldIgnoreThePrefixForAlphaPicker = null,
|
||||
bool? isThemeCachingEnabled = null,
|
||||
bool? shouldAggregateMetadataWhenMissing = null)
|
||||
bool? shouldAggregateMetadataWhenMissing = null,
|
||||
bool? shouldRenderPdfAsImages = null,
|
||||
bool? shouldPreserveBookStyles = null)
|
||||
{
|
||||
return new UserSettingsDto
|
||||
{
|
||||
@@ -42,7 +46,9 @@ public class UserSettingsDtoFixture
|
||||
ItemsPerPage = itemsPerPage ?? _faker.Random.Int(1, 200),
|
||||
ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker ?? _faker.Random.Bool(),
|
||||
IsThemeCachingEnabled = isThemeCachingEnabled ?? _faker.Random.Bool(),
|
||||
ShouldAggregateMetadataWhenMissing = shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool()
|
||||
ShouldAggregateMetadataWhenMissing = shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool(),
|
||||
ShouldRenderPdfAsImages = shouldRenderPdfAsImages ?? _faker.Random.Bool(),
|
||||
ShouldPreserveBookStyles = shouldPreserveBookStyles ?? _faker.Random.Bool()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.Management;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.Management;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBookReadersRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBookReadersRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose book readers are retrieved.</param>
|
||||
/// <returns>The created <see cref="GetBookReadersRequest"/>.</returns>
|
||||
public GetBookReadersRequest Create(
|
||||
Guid? libraryId = null)
|
||||
{
|
||||
return new GetBookReadersRequest(libraryId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBookReadersRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBookReadersRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBookReadingAvailabilityRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBookReadingAvailabilityRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetBookReadingAvailabilityRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading availability is checked.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingAvailabilityRequest"/>.</returns>
|
||||
public GetBookReadingAvailabilityRequest Create(
|
||||
Guid? bookId = null)
|
||||
{
|
||||
return new GetBookReadingAvailabilityRequest(bookId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBookReadingAvailabilityRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBookReadingAvailabilityRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBookReadingManifestRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBookReadingManifestRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetBookReadingManifestRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading manifest is retrieved.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingManifestRequest"/>.</returns>
|
||||
public GetBookReadingManifestRequest Create(
|
||||
Guid? bookId = null)
|
||||
{
|
||||
return new GetBookReadingManifestRequest(bookId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBookReadingManifestRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBookReadingManifestRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBookReadingResourceRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBookReadingResourceRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetBookReadingResourceRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose resource is retrieved.</param>
|
||||
/// <param name="resourceKey">Optional. The opaque resource key of the resource.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingResourceRequest"/>.</returns>
|
||||
public GetBookReadingResourceRequest Create(
|
||||
Guid? bookId = null,
|
||||
string? resourceKey = null)
|
||||
{
|
||||
return new GetBookReadingResourceRequest(bookId ?? Guid.NewGuid(), resourceKey ?? $"resource-{Guid.NewGuid():N}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBookReadingResourceRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBookReadingResourceRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetBookReadingSectionRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetBookReadingSectionRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="GetBookReadingSectionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book whose reading section is retrieved.</param>
|
||||
/// <param name="locationRef">Optional. The opaque location reference of the reading section.</param>
|
||||
/// <returns>The created <see cref="GetBookReadingSectionRequest"/>.</returns>
|
||||
public GetBookReadingSectionRequest Create(
|
||||
Guid? bookId = null,
|
||||
string? locationRef = null)
|
||||
{
|
||||
return new GetBookReadingSectionRequest(bookId ?? Guid.NewGuid(), locationRef ?? $"section-{Guid.NewGuid():N}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetBookReadingSectionRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<GetBookReadingSectionRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="ReadBookViewRequest"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ReadBookViewRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="ReadBookViewRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="bookId">Optional. The Id of the book to read.</param>
|
||||
/// <returns>The created <see cref="ReadBookViewRequest"/>.</returns>
|
||||
public ReadBookViewRequest Create(
|
||||
Guid? bookId = null)
|
||||
{
|
||||
return new ReadBookViewRequest(bookId ?? Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="ReadBookViewRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<ReadBookViewRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Requests.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="SetBookReaderEnabledRequest"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SetBookReaderEnabledRequestFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="SetBookReaderEnabledRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library whose book reader is enabled or disabled.</param>
|
||||
/// <param name="pluginId">Optional. The unique identifier of the plugin providing the book reader.</param>
|
||||
/// <param name="isEnabled">Optional. Whether the book reader should be enabled for the media library.</param>
|
||||
/// <returns>The created <see cref="SetBookReaderEnabledRequest"/>.</returns>
|
||||
public SetBookReaderEnabledRequest Create(
|
||||
Guid? libraryId = null,
|
||||
Guid? pluginId = null,
|
||||
bool? isEnabled = null)
|
||||
{
|
||||
return new SetBookReaderEnabledRequest
|
||||
{
|
||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
||||
PluginId = pluginId ?? Guid.NewGuid(),
|
||||
IsEnabled = isEnabled ?? true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="SetBookReaderEnabledRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of elements to create.</param>
|
||||
/// <returns>The created list.</returns>
|
||||
public List<SetBookReaderEnabledRequest> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user