mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 09:01:10 +00:00
Removes the umbrella include flag from the fixtures and their consumers
This commit is contained in:
1 parent
ab5cbfb949
commit
4d96fe10dd
43 files changed
+930
-349
No files matched your search
+10
-1
@@ -63,7 +63,16 @@ public class AddTrackRequestMappingTests
|
||||
AddTrackRequest request = _addTrackRequestFixture.Create(
|
||||
path: "/music/queen/bohemian-rhapsody.flac",
|
||||
metadata: _audioMetadataDtoFixture.Create(title: "Love of My Life"),
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false,
|
||||
includeMoods: false,
|
||||
includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
AddTrackCommand result = request.ToCommand(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class UpdateTrackCommandMappingTests
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
(Artist artist, Guid albumId, Guid trackId) = CreateDomainArtist(libraryId);
|
||||
string updatedPath = "/music/queen/a-night-at-the-opera/03-you-re-my-best-friend.flac";
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artist.Id.Value.ToString(), albumId: albumId.ToString(), trackId: trackId.ToString(), path: updatedPath, includeOptionalProperties: false, contributors: [], ratings: []);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(libraryId: libraryId.ToString(), artistId: artist.Id.Value.ToString(), albumId: albumId.ToString(), trackId: trackId.ToString(), path: updatedPath, includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false, contributors: [], ratings: []);
|
||||
|
||||
// Act
|
||||
Result<Artist> result = command.ToDomainEntity(artist);
|
||||
|
||||
+21
-2
@@ -63,7 +63,19 @@ public class UpdateTrackRequestMappingTests
|
||||
Guid artistId = Guid.NewGuid();
|
||||
Guid albumId = Guid.NewGuid();
|
||||
Guid trackId = Guid.NewGuid();
|
||||
UpdateTrackRequest request = _updateTrackRequestFixture.Create(includeOptionalProperties: false, contributors: [], ratings: []);
|
||||
UpdateTrackRequest request = _updateTrackRequestFixture.Create(
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false,
|
||||
includeMoods: false,
|
||||
includeIsrcs: false,
|
||||
contributors: [],
|
||||
ratings: []);
|
||||
|
||||
// Act
|
||||
UpdateTrackCommand result = request.ToCommand(libraryId.ToString(), artistId.ToString(), albumId.ToString(), trackId.ToString());
|
||||
@@ -103,7 +115,14 @@ public class UpdateTrackRequestMappingTests
|
||||
isrcs: [new("GBUM71029604")],
|
||||
contributors: [new(Guid.NewGuid(), MediaContributorRole.Vocals)],
|
||||
ratings: [new(4.5m, 5m, AudioRatingSource.MusicBrainz, 1000)],
|
||||
includeOptionalProperties: false);
|
||||
includeDiscNumber: false,
|
||||
includeScript: false,
|
||||
includeKey: false,
|
||||
includeBpm: false,
|
||||
includeWork: false,
|
||||
includeMusicBrainzRecordingId: false,
|
||||
includeMusicBrainzTrackId: false,
|
||||
includeMusicBrainzWorkId: false);
|
||||
|
||||
// Act
|
||||
UpdateTrackCommand result = request.ToCommand(libraryId.ToString(), artistId.ToString(), albumId.ToString(), trackId.ToString());
|
||||
|
||||
+13
-2
@@ -62,7 +62,18 @@ public class AddBookCommandMappingTests
|
||||
isbns: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false);
|
||||
|
||||
// Act
|
||||
Result<Book> result = command.ToDomainEntity(libraryId);
|
||||
@@ -92,7 +103,7 @@ public class AddBookCommandMappingTests
|
||||
public void ToDomainEntity_WhenRatingCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
AddBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
Result<Book> result = command.ToDomainEntity(Guid.NewGuid());
|
||||
|
||||
+27
-2
@@ -64,7 +64,21 @@ public class AddBookRequestMappingTests
|
||||
AddBookRequest request = _requestFixture.Create(
|
||||
path: "/books/test.epub",
|
||||
metadata: _writtenContentMetadataDtoFixture.Create(title: "Test Book"),
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false,
|
||||
includeIsbns: false,
|
||||
includeRatings: false,
|
||||
includeContributors: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -105,7 +119,18 @@ public class AddBookRequestMappingTests
|
||||
_mediaContributorReferenceDtoFixture.Create(role: MediaContributorRole.Author)
|
||||
],
|
||||
ratings: [new(4.5m, 5m, BookRatingSource.Goodreads, 1000)],
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false
|
||||
);
|
||||
|
||||
// Act
|
||||
|
||||
+10
-5
@@ -24,6 +24,7 @@ public class BookMetadataDtoMappingTests
|
||||
private readonly BookFixture _bookFixture = new();
|
||||
private readonly BookMetadataDtoFixture _bookMetadataDtoFixture = new();
|
||||
private readonly GenreDtoFixture _genreDtoFixture = new();
|
||||
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void ApplyMetadata_WhenCalledWithValidMetadata_ShouldApplyItToTheBook()
|
||||
@@ -76,7 +77,7 @@ public class BookMetadataDtoMappingTests
|
||||
{
|
||||
// Arrange
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: title, includeOptionalProperties: false);
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(includeTitle: title is not null, title: title, includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -91,7 +92,7 @@ public class BookMetadataDtoMappingTests
|
||||
{
|
||||
// Arrange
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: "A valid title", includeOptionalProperties: false);
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(title: "A valid title", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -108,7 +109,7 @@ public class BookMetadataDtoMappingTests
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(
|
||||
title: "A valid title",
|
||||
releaseInfo: new ReleaseInfoDto(new DateOnly(2000, 1, 1), 1999, null, null, null, null));
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 1999));
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
@@ -173,8 +174,12 @@ public class BookMetadataDtoMappingTests
|
||||
Book book = _bookFixture.Create();
|
||||
BookMetadataDto metadata = _bookMetadataDtoFixture.Create(
|
||||
title: "A valid title",
|
||||
releaseInfo: new ReleaseInfoDto(new DateOnly(2000, 1, 1), 2000, null, null, null, null),
|
||||
includeOptionalProperties: false);
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2000, 1, 1), originalReleaseYear: 2000),
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false);
|
||||
|
||||
// Act
|
||||
Result<Success> result = book.ApplyMetadata(metadata);
|
||||
|
||||
+13
-2
@@ -72,7 +72,18 @@ public class UpdateBookCommandMappingTests
|
||||
isbns: [],
|
||||
contributors: [],
|
||||
ratings: [],
|
||||
includeOptionalProperties: false);
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false);
|
||||
BookEntity existingBook = _bookEntityFixture.Create(id: bookId, libraryId: libraryId, path: "/books/the-book.epub");
|
||||
|
||||
// Act
|
||||
@@ -104,7 +115,7 @@ public class UpdateBookCommandMappingTests
|
||||
public void ToDomainEntity_WhenRatingCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
BookEntity existingBook = _bookEntityFixture.Create();
|
||||
|
||||
// Act
|
||||
|
||||
+14
-3
@@ -61,7 +61,7 @@ public class UpdateBookRequestMappingTests
|
||||
// Arrange
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
Guid bookId = Guid.NewGuid();
|
||||
UpdateBookRequest request = _requestFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
UpdateBookCommand result = request.ToCommand(libraryId.ToString(), bookId.ToString());
|
||||
@@ -102,7 +102,18 @@ public class UpdateBookRequestMappingTests
|
||||
_mediaContributorReferenceDtoFixture.Create(role: MediaContributorRole.Author)
|
||||
],
|
||||
ratings: [new(4.5m, 5m, BookRatingSource.Goodreads, 1000)],
|
||||
includeOptionalProperties: false
|
||||
includeFormat: false,
|
||||
includeEdition: false,
|
||||
includeVolumeNumber: false,
|
||||
includeAsin: false,
|
||||
includeGoodreadsId: false,
|
||||
includeLccn: false,
|
||||
includeOclcNumber: false,
|
||||
includeOpenLibraryId: false,
|
||||
includeLibraryThingId: false,
|
||||
includeGoogleBooksId: false,
|
||||
includeBarnesAndNobleId: false,
|
||||
includeAppleBooksId: false
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -119,7 +130,7 @@ public class UpdateBookRequestMappingTests
|
||||
public void ToCommand_WhenRouteValuesAreNotParseable_ShouldMapThemAsIs()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookRequest request = _requestFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookRequest request = _requestFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
UpdateBookCommand result = request.ToCommand("not-a-library-guid", "not-a-guid");
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ public class BookRatingDtoMappingTests
|
||||
public void ToDomainEntity_WhenMappingMinimalBookRatingDto_ShouldMapRequiredPropertiesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(includeOptionalProperties: false);
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false);
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
@@ -90,7 +90,7 @@ public class BookRatingDtoMappingTests
|
||||
List<BookRatingDto> dtos =
|
||||
[
|
||||
_bookRatingDtoFixture.Create(),
|
||||
_bookRatingDtoFixture.Create(includeOptionalProperties: false)
|
||||
_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)
|
||||
];
|
||||
|
||||
// Act
|
||||
@@ -125,7 +125,7 @@ public class BookRatingDtoMappingTests
|
||||
[
|
||||
_bookRatingDtoFixture.Create(),
|
||||
_bookRatingDtoFixture.Create(value: 10, maxValue: 5),
|
||||
_bookRatingDtoFixture.Create(includeOptionalProperties: false)
|
||||
_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)
|
||||
];
|
||||
|
||||
// Act
|
||||
|
||||
+10
-10
@@ -419,7 +419,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -432,7 +432,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -458,7 +458,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -471,7 +471,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(metadata: _audioMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -943,7 +943,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1054,7 +1054,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1093,7 +1093,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1132,7 +1132,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1173,7 +1173,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1212,7 +1212,7 @@ public class AddTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
AddTrackCommand command = _addTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+8
-8
@@ -1175,7 +1175,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzRecordingIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1214,7 +1214,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzTrackIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1253,7 +1253,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenMusicBrainzWorkIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1357,7 +1357,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenDiscNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1396,7 +1396,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenScriptIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1435,7 +1435,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenKeyIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1487,7 +1487,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenBpmIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
@@ -1526,7 +1526,7 @@ public class UpdateTrackCommandValidatorTests
|
||||
public void Validate_WhenWorkIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeOptionalProperties: false);
|
||||
UpdateTrackCommand command = _updateTrackCommandFixture.Create(includeDiscNumber: false, includeScript: false, includeKey: false, includeBpm: false, includeWork: false, includeMusicBrainzRecordingId: false, includeMusicBrainzTrackId: false, includeMusicBrainzWorkId: false, includeMoods: false, includeIsrcs: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(command);
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ public class AddBookCommandHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithInvalidRating_ShouldReturnFailureResult()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
Result<BookResponse> result = await _sut.HandleAsync(bookCommand, CancellationToken.None);
|
||||
|
||||
+19
-19
@@ -210,7 +210,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -223,7 +223,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -249,7 +249,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -262,7 +262,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -756,7 +756,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -795,7 +795,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenEditionIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -834,7 +834,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenVolumeNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -954,7 +954,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenAsinIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -980,7 +980,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenGoodreadsIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1045,7 +1045,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenLccnIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1110,7 +1110,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyOclcNumber_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1201,7 +1201,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenOpenLibraryIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1266,7 +1266,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyLibraryThingId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1305,7 +1305,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyGoogleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1357,7 +1357,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyBarnesAndNobleId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1409,7 +1409,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyAppleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1448,7 +1448,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullIsbns_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1591,7 +1591,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullRatings_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1669,7 +1669,7 @@ public class AddBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullVoteCount_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeOptionalProperties: false)]);
|
||||
AddBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
|
||||
+1
-1
@@ -343,7 +343,7 @@ public class UpdateBookCommandHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithInvalidRating_ShouldReturnFailureResult()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeOptionalProperties: false)]);
|
||||
UpdateBookCommand command = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(value: -1, maxValue: 5, includeSource: false, includeVoteCount: false)]);
|
||||
BookEntity existingBook = _bookEntityFixture.Create(id: Guid.Parse(command.BookId!), libraryId: Guid.Parse(command.LibraryId!));
|
||||
_mockBookRepository.GetByIdAsync(Arg.Any<Guid>(), Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<BookEntity?>(existingBook));
|
||||
|
||||
+19
-19
@@ -197,7 +197,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 0, null, null, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -210,7 +210,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOriginalReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, 10000, null, null, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -236,7 +236,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsLessThan1_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 0, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 0)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -249,7 +249,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenReReleaseYearIsGreaterThan9999_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: new ReleaseInfoDto(null, null, null, 10000, null, null)));
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(metadata: _writtenContentMetadataDtoFixture.Create(releaseInfo: _releaseInfoDtoFixture.Create(reReleaseYear: 10000)));
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -743,7 +743,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenFormatIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -782,7 +782,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenEditionIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -821,7 +821,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenVolumeNumberIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -941,7 +941,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenAsinIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -967,7 +967,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenGoodreadsIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1032,7 +1032,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenLccnIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1097,7 +1097,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyOclcNumber_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1188,7 +1188,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenOpenLibraryIdIsNull_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1253,7 +1253,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyLibraryThingId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1292,7 +1292,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyGoogleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1344,7 +1344,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyBarnesAndNobleId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1396,7 +1396,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithEmptyAppleBooksId_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1435,7 +1435,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullIsbns_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1578,7 +1578,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullRatings_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeOptionalProperties: false);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(includeFormat: false, includeEdition: false, includeVolumeNumber: false, includeAsin: false, includeGoodreadsId: false, includeLccn: false, includeOclcNumber: false, includeOpenLibraryId: false, includeLibraryThingId: false, includeGoogleBooksId: false, includeBarnesAndNobleId: false, includeAppleBooksId: false, includeIsbns: false, includeRatings: false, includeContributors: false);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
@@ -1656,7 +1656,7 @@ public class UpdateBookCommandValidatorTests
|
||||
public void Validate_WhenCalledWithNullVoteCount_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeOptionalProperties: false)]);
|
||||
UpdateBookCommand bookCommand = _commandBookFixture.Create(ratings: [_bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false)]);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(bookCommand);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class BookRatingDtoTests
|
||||
public void Create_WhenOmittingOptionalProperties_ShouldReturnNullSourceAndVoteCount()
|
||||
{
|
||||
// Act
|
||||
BookRatingDto sut = _bookRatingDtoFixture.Create(includeOptionalProperties: false);
|
||||
BookRatingDto sut = _bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false);
|
||||
|
||||
// Assert
|
||||
Assert.Null(sut.Source);
|
||||
|
||||
+281
-32
@@ -32,7 +32,11 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothMetadataHaveScalarValues_ShouldKeepTheFirstValues()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false,
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
title: "First Title",
|
||||
originalTitle: "First Original Title",
|
||||
description: "First Description",
|
||||
@@ -51,7 +55,11 @@ public class MetadataAggregatorTests
|
||||
barnesAndNobleId: "FIRST-BN",
|
||||
appleBooksId: "FIRST-APPLE",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false,
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
title: "Second Title",
|
||||
originalTitle: "Second Original Title",
|
||||
description: "Second Description",
|
||||
@@ -99,8 +107,29 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenFirstHasNullScalars_ShouldFallBackToTheSecondValues()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, description: null, publisher: null, pageCount: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: "Second Title", description: "Second Description", publisher: "Second Publisher", pageCount: 200);
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
description: null,
|
||||
publisher: null,
|
||||
pageCount: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Second Title",
|
||||
description: "Second Description",
|
||||
publisher: "Second Publisher",
|
||||
pageCount: 200);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -116,8 +145,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveNullScalars_ShouldReturnNullScalars()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, coverImagePath: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(includeOptionalProperties: false, title: null, coverImagePath: null);
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
coverImagePath: null);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeTitle: false,
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: null,
|
||||
coverImagePath: null);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -137,10 +184,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveReleaseInfo_ShouldCoalesceEachField()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false);
|
||||
first = first with { ReleaseInfo = _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, releaseCountry: ReleaseCountry.US) };
|
||||
second = second with { ReleaseInfo = _releaseInfoDtoFixture.Create(reReleaseDate: new DateOnly(2010, 5, 5), reReleaseYear: 2010, releaseCountry: ReleaseCountry.GB, releaseVersion: "2.0") };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001, releaseCountry: ReleaseCountry.US));
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(reReleaseDate: new DateOnly(2010, 5, 5), reReleaseYear: 2010, releaseCountry: ReleaseCountry.GB, releaseVersion: "2.0"));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -158,8 +219,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenFirstReleaseInfoIsNull_ShouldUseTheSecondReleaseInfo()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001) };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
releaseInfo: _releaseInfoDtoFixture.Create(originalReleaseDate: new DateOnly(2001, 1, 1), originalReleaseYear: 2001));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -172,8 +249,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothReleaseInfosAreNull_ShouldReturnNullReleaseInfo()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { ReleaseInfo = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -186,8 +279,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveGenres_ShouldUnionAndDeDuplicateByName()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Genres = [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Space opera")] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Genres = [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Fantasy")] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
genres: [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Space opera")]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
genres: [_genreDtoFixture.Create(name: "Science fiction"), _genreDtoFixture.Create(name: "Fantasy")]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -203,8 +312,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveTags_ShouldUnionAndDeDuplicateByName()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag B")] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag C")] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag B")]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A"), _tagDtoFixture.Create(name: "Tag C")]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -220,8 +345,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveIsbns_ShouldUnionAndDeDuplicateByValue()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13), _isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13), _isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -236,8 +379,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveContributors_ShouldUnionAndDeDuplicateByDisplayNameAndRole()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author), _mediaContributorDtoFixture.Create("Translator B", MediaContributorRole.Translator)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author), _mediaContributorDtoFixture.Create("Translator B", MediaContributorRole.Translator)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -252,8 +413,26 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveRatings_ShouldUnionAndDeDuplicateBySource()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null), _bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null), _bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -268,8 +447,27 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenOnlyFirstHasCollections_ShouldReturnTheFirstCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag A")], Genres = [_genreDtoFixture.Create(name: "Genre A")], Isbns = [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)], Contributors = [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)], Ratings = [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)] };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag A")],
|
||||
genres: [_genreDtoFixture.Create(name: "Genre A")],
|
||||
isbns: [_isbnDtoFixture.Create(value: "9780306406157", format: IsbnFormat.Isbn13)],
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author A", MediaContributorRole.Author)],
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 8m, maxValue: 10m, source: BookRatingSource.Calibre, voteCount: null)]);
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -286,8 +484,27 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenOnlySecondHasCollections_ShouldReturnTheSecondCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = [_tagDtoFixture.Create(name: "Tag B")], Genres = [_genreDtoFixture.Create(name: "Genre B")], Isbns = [_isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)], Contributors = [_mediaContributorDtoFixture.Create("Author B", MediaContributorRole.Author)], Ratings = [_bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)] };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
tags: [_tagDtoFixture.Create(name: "Tag B")],
|
||||
genres: [_genreDtoFixture.Create(name: "Genre B")],
|
||||
isbns: [_isbnDtoFixture.Create(value: "0306406152", format: IsbnFormat.Isbn10)],
|
||||
contributors: [_mediaContributorDtoFixture.Create("Author B", MediaContributorRole.Author)],
|
||||
ratings: [_bookRatingDtoFixture.Create(value: 4.2m, maxValue: 5m, source: BookRatingSource.OpenLibrary, voteCount: 100)]);
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -304,8 +521,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveNullCollections_ShouldReturnNullCollections()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Tags = null, Genres = null, Isbns = null, Contributors = null, Ratings = null };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeLanguage: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover");
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
@@ -322,8 +555,24 @@ public class MetadataAggregatorTests
|
||||
public void Merge_WhenBothHaveLanguages_ShouldKeepTheFirstLanguage()
|
||||
{
|
||||
// Arrange
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Language = _languageInfoDtoFixture.Create(languageCode: "en", languageName: "English", nativeName: "English") };
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(title: "Title", coverImagePath: "First Cover", includeOptionalProperties: false) with { Language = _languageInfoDtoFixture.Create(languageCode: "de", languageName: "German", nativeName: "Deutsch") };
|
||||
BookMetadataDto first = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
language: _languageInfoDtoFixture.Create(languageCode: "en", languageName: "English", nativeName: "English"));
|
||||
BookMetadataDto second = _bookMetadataDtoFixture.Create(
|
||||
includeReleaseInfo: false,
|
||||
includeGenres: false,
|
||||
includeTags: false,
|
||||
includeFormat: false,
|
||||
includeVolumeNumber: false,
|
||||
title: "Title",
|
||||
coverImagePath: "First Cover",
|
||||
language: _languageInfoDtoFixture.Create(languageCode: "de", languageName: "German", nativeName: "Deutsch"));
|
||||
|
||||
// Act
|
||||
BookMetadataDto result = MetadataAggregator.Merge(first, second);
|
||||
|
||||
+4
-4
@@ -30,7 +30,7 @@ public class IMetadataProviderGenericTests
|
||||
// Arrange
|
||||
BookMetadataLookupDto lookup = _bookMetadataLookupDtoFixture.Create();
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Search Result", includeOptionalProperties: false);
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Search Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
TestBookMetadataProvider provider = new(expectedMetadata);
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IMetadataProviderGenericTests
|
||||
// Arrange
|
||||
BookMetadataLookupDto lookup = _bookMetadataLookupDtoFixture.Create();
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Exact Result", includeOptionalProperties: false);
|
||||
BookMetadataDto expectedMetadata = _bookMetadataDtoFixture.Create(title: "Exact Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false);
|
||||
TestBookMetadataProvider provider = new(expectedMetadata);
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class IMetadataProviderGenericTests
|
||||
{
|
||||
// Arrange
|
||||
MetadataLookupDto otherLookup = _otherMetadataLookupDtoFixture.Create();
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Search Result", includeOptionalProperties: false));
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Search Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false));
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
// Act
|
||||
@@ -87,7 +87,7 @@ public class IMetadataProviderGenericTests
|
||||
{
|
||||
// Arrange
|
||||
MetadataLookupDto otherLookup = _otherMetadataLookupDtoFixture.Create();
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Exact Result", includeOptionalProperties: false));
|
||||
TestBookMetadataProvider provider = new(_bookMetadataDtoFixture.Create(title: "Exact Result", includeReleaseInfo: false, includeGenres: false, includeTags: false, includeLanguage: false, includeFormat: false, includeVolumeNumber: false));
|
||||
IMetadataProvider baseProvider = provider;
|
||||
|
||||
// Act
|
||||
|
||||
Reference in new issue
Block a user