mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 02:11:10 +00:00
Adds the music library application mappings and renames the value object conversion methods
This commit is contained in:
1 parent
a939d8fd5f
commit
4f0526faa4
98 files changed
+2869
-610
No files matched your search
+8
-8
@@ -21,13 +21,13 @@ public class BookRatingDtoMappingTests
|
||||
private readonly BookRatingDtoFixture _bookRatingDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingCompleteBookRatinDto_ShouldMapAllPropertiesCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingCompleteBookRatinDto_ShouldMapAllPropertiesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create();
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -53,13 +53,13 @@ public class BookRatingDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingMinimalBookRatingDto_ShouldMapRequiredPropertiesCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingMinimalBookRatingDto_ShouldMapRequiredPropertiesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(includeSource: false, includeVoteCount: false);
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -71,13 +71,13 @@ public class BookRatingDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingInvalidBookRatingDto_ShouldReturnError()
|
||||
public void ToDomainValueObject_WhenMappingInvalidBookRatingDto_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingDto dto = _bookRatingDtoFixture.Create(value: 10, maxValue: 5);
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
@@ -94,7 +94,7 @@ public class BookRatingDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
@@ -129,7 +129,7 @@ public class BookRatingDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+6
-6
@@ -76,13 +76,13 @@ public class BookRatingEntityMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingValidBookRatingEntity_ShouldMapCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingValidBookRatingEntity_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingEntity entity = _fixture.Create();
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = entity.ToDomainEntity();
|
||||
Result<BookRating> result = entity.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -94,13 +94,13 @@ public class BookRatingEntityMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingInvalidBookRatingEntity_ShouldMapToDefaults()
|
||||
public void ToDomainValueObject_WhenMappingInvalidBookRatingEntity_ShouldMapToDefaults()
|
||||
{
|
||||
// Arrange
|
||||
BookRatingEntity entity = _fixture.Create(includeValues: false);
|
||||
|
||||
// Act
|
||||
Result<BookRating> result = entity.ToDomainEntity();
|
||||
Result<BookRating> result = entity.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -112,13 +112,13 @@ public class BookRatingEntityMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntities_WhenMappingMultipleBookRatingEntities_ShouldMapAllCorrectly()
|
||||
public void ToDomainValueObjects_WhenMappingMultipleBookRatingEntities_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<BookRatingEntity> entities = _fixture.CreateMany(2);
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<BookRating>> results = entities.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = entities.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+10
-10
@@ -22,13 +22,13 @@ public class IsbnDtoMappingTests
|
||||
private readonly IsbnDtoFixture _isbnDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingValidIsbn10Dto_ShouldMapCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingValidIsbn10Dto_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
IsbnDto dto = _isbnDtoFixture.Create(format: IsbnFormat.Isbn10);
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -38,13 +38,13 @@ public class IsbnDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingValidIsbn13Dto_ShouldMapCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingValidIsbn13Dto_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
IsbnDto dto = _isbnDtoFixture.Create(format: IsbnFormat.Isbn13);
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -54,13 +54,13 @@ public class IsbnDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingDtoWithoutFormat_ShouldUseDefaultFormat()
|
||||
public void ToDomainValueObject_WhenMappingDtoWithoutFormat_ShouldUseDefaultFormat()
|
||||
{
|
||||
// Arrange
|
||||
IsbnDto dto = _isbnDtoFixture.Create();
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -70,13 +70,13 @@ public class IsbnDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingInvalidIsbnDto_ShouldReturnError()
|
||||
public void ToDomainValueObject_WhenMappingInvalidIsbnDto_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
IsbnDto dto = _isbnDtoFixture.Create("invalid-isbn", IsbnFormat.Isbn13);
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
@@ -94,7 +94,7 @@ public class IsbnDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
@@ -125,7 +125,7 @@ public class IsbnDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+7
-7
@@ -61,7 +61,7 @@ public class IsbnEntityMappingTests
|
||||
public void ToResponse_WhenMappingInvalidIsbnEntity_ShouldPreserveValues(string? value, IsbnFormat? format)
|
||||
{
|
||||
// Arrange
|
||||
IsbnEntity entity = _isbnEntityFixture.Create(value: value, format: format, includeValue: value is not null);
|
||||
IsbnEntity entity = _isbnEntityFixture.Create(value: value, format: format, includeValue: value is not null, includeFormat: false);
|
||||
|
||||
// Act
|
||||
IsbnDto result = entity.ToResponse();
|
||||
@@ -72,13 +72,13 @@ public class IsbnEntityMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingValidIsbnEntity_ShouldMapCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingValidIsbnEntity_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
IsbnEntity entity = _isbnEntityFixture.Create(value: "0-7475-3269-9", format: IsbnFormat.Isbn10);
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = entity.ToDomainEntity();
|
||||
Result<Isbn> result = entity.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -91,20 +91,20 @@ public class IsbnEntityMappingTests
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
[InlineData(null)]
|
||||
public void ToDomainEntity_WhenMappingInvalidIsbnEntity_ShouldReturnError(string? invalidValue)
|
||||
public void ToDomainValueObject_WhenMappingInvalidIsbnEntity_ShouldReturnError(string? invalidValue)
|
||||
{
|
||||
// Arrange
|
||||
IsbnEntity entity = _isbnEntityFixture.Create(value: invalidValue, includeValue: invalidValue is not null);
|
||||
|
||||
// Act
|
||||
Result<Isbn> result = entity.ToDomainEntity();
|
||||
Result<Isbn> result = entity.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntities_WhenMappingMultipleValidIsbnEntities_ShouldMapAllCorrectly()
|
||||
public void ToDomainValueObjects_WhenMappingMultipleValidIsbnEntities_ShouldMapAllCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
List<IsbnEntity> entities =
|
||||
@@ -114,7 +114,7 @@ public class IsbnEntityMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<Result<Isbn>> results = entities.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = entities.ToDomainValueObjects();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
|
||||
+10
-10
@@ -23,13 +23,13 @@ public class WrittenContentMetadataDtoMappingTests
|
||||
private readonly TagDtoFixture _tagDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenMappingCompleteWrittenContentMetadataDto_ShouldMapAllPropertiesCorrectly()
|
||||
public void ToDomainValueObject_WhenMappingCompleteWrittenContentMetadataDto_ShouldMapAllPropertiesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
WrittenContentMetadataDto dto = _writtenContentMetadataDtoFixture.Create();
|
||||
|
||||
// Act
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainEntity();
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -51,7 +51,7 @@ public class WrittenContentMetadataDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenOptionalValuesAreMissing_ShouldMapWithoutOptionalValues()
|
||||
public void ToDomainValueObject_WhenOptionalValuesAreMissing_ShouldMapWithoutOptionalValues()
|
||||
{
|
||||
// Arrange
|
||||
WrittenContentMetadataDto dto = _writtenContentMetadataDtoFixture.Create(
|
||||
@@ -63,7 +63,7 @@ public class WrittenContentMetadataDtoMappingTests
|
||||
includePageCount: false);
|
||||
|
||||
// Act
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainEntity();
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
@@ -76,7 +76,7 @@ public class WrittenContentMetadataDtoMappingTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenReleaseInfoCreationFails_ShouldReturnError()
|
||||
public void ToDomainValueObject_WhenReleaseInfoCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
WrittenContentMetadataDto dto = _writtenContentMetadataDtoFixture.Create(
|
||||
@@ -85,33 +85,33 @@ public class WrittenContentMetadataDtoMappingTests
|
||||
originalReleaseYear: 2024));
|
||||
|
||||
// Act
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainEntity();
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenGenreCreationFails_ShouldReturnError()
|
||||
public void ToDomainValueObject_WhenGenreCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
WrittenContentMetadataDto dto = _writtenContentMetadataDtoFixture.Create(genres: [_genreDtoFixture.Create(name: "")]);
|
||||
|
||||
// Act
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainEntity();
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToDomainEntity_WhenTagCreationFails_ShouldReturnError()
|
||||
public void ToDomainValueObject_WhenTagCreationFails_ShouldReturnError()
|
||||
{
|
||||
// Arrange
|
||||
WrittenContentMetadataDto dto = _writtenContentMetadataDtoFixture.Create(tags: [_tagDtoFixture.Create(name: "")]);
|
||||
|
||||
// Act
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainEntity();
|
||||
Result<WrittenContentMetadata> result = dto.ToDomainValueObject();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
|
||||
Reference in new issue
Block a user