mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Refactors the add book slice and shared media contributor model across the stack
This commit is contained in:
1 parent
3a2c80b615
commit
9a71a6d32b
61 files changed
+5223
-1384
No files matched your search
+1
-1
@@ -24,7 +24,7 @@ public class MediaContributorDtoTests
|
||||
// Arrange
|
||||
MediaContributorDto expected = new(
|
||||
new MediaContributorNameDto("John Smith", "Johnathan Smith"),
|
||||
new MediaContributorRoleDto("Author", MediaContributorRoleCategory.Author)
|
||||
MediaContributorRole.Author
|
||||
);
|
||||
|
||||
// Act
|
||||
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.DTO.MediaContributors;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="MediaContributorRoleDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MediaContributorRoleDtoTests
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingRole_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
MediaContributorRoleDto expected = new("Author", MediaContributorRoleCategory.Author);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
MediaContributorRoleDto? actual = JsonSerializer.Deserialize<MediaContributorRoleDto>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
MediaContributorRoleDto first = new("Illustrator", null);
|
||||
MediaContributorRoleDto second = new("Illustrator", null);
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
@@ -36,7 +36,6 @@ public class AddBookRequestTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.NotEqual(Guid.Empty, sut.LibraryId);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
|
||||
Assert.NotNull(sut.Metadata);
|
||||
Assert.NotNull(sut.ISBNs);
|
||||
@@ -83,10 +82,9 @@ public class AddBookRequestTests
|
||||
AddBookRequest sut = _addBookRequestFixture.Create();
|
||||
|
||||
// Act
|
||||
(Guid libraryId, string path, WrittenContentMetadataDto? metadata, BookFormat? format, string? edition, float? volumeNumber, BookSeriesDto? series, string? asin, string? goodreadsId, string? lccn, string? oclcNumber, string? openLibraryId, string? libraryThingId, string? googleBooksId, string? barnesAndNobleId, string? appleBooksId, List<IsbnDto>? isbns, List<MediaContributorDto>? contributors, List<BookRatingDto>? ratings) = sut;
|
||||
(string path, WrittenContentMetadataDto? metadata, BookFormat? format, string? edition, float? volumeNumber, BookSeriesDto? series, string? asin, string? goodreadsId, string? lccn, string? oclcNumber, string? openLibraryId, string? libraryThingId, string? googleBooksId, string? barnesAndNobleId, string? appleBooksId, List<IsbnDto>? isbns, List<MediaContributorReferenceDto>? contributors, List<BookRatingDto>? ratings) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.LibraryId, libraryId);
|
||||
Assert.Equal(sut.Path, path);
|
||||
Assert.Equal(sut.Metadata, metadata);
|
||||
Assert.Equal(sut.Format, format);
|
||||
|
||||
Reference in new issue
Block a user