mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
Replaces ErrorOr library with a custom implementation.
This commit is contained in:
1 parent
8fe90a4dde
commit
3b772d68ca
436 files changed
+4234
-3922
No files matched your search
+8
-8
@@ -1,13 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -25,7 +25,7 @@ public class LibraryMappingTests
|
||||
public void ToRepositoryEntity_WhenMappingValidLibrary_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Test Library",
|
||||
LibraryType.Book,
|
||||
@@ -64,7 +64,7 @@ public class LibraryMappingTests
|
||||
public void ToRepositoryEntity_WhenMappingLibraryWithEmptyContentLocations_ShouldMapCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Empty Library",
|
||||
LibraryType.Book,
|
||||
@@ -96,7 +96,7 @@ public class LibraryMappingTests
|
||||
public void ToRepositoryEntity_WhenMappingDifferentLibraryTypes_ShouldMapCorrectly(LibraryType libraryType)
|
||||
{
|
||||
// Arrange
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Test Library",
|
||||
libraryType,
|
||||
@@ -136,7 +136,7 @@ public class LibraryMappingTests
|
||||
"F:/Reading Material"
|
||||
];
|
||||
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Test Library",
|
||||
LibraryType.Book,
|
||||
@@ -170,7 +170,7 @@ public class LibraryMappingTests
|
||||
"D:/Books"
|
||||
];
|
||||
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Test Library",
|
||||
LibraryType.Book,
|
||||
@@ -204,7 +204,7 @@ public class LibraryMappingTests
|
||||
"D:/Books"
|
||||
];
|
||||
|
||||
ErrorOr<Library> libraryResult = Library.Create(
|
||||
Result<Library> libraryResult = Library.Create(
|
||||
UserId.CreateUnique(),
|
||||
"Test Library",
|
||||
LibraryType.Book,
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook.Fixtures;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -37,10 +37,10 @@ public class BookEntityMappingTests
|
||||
BookEntity bookEntity = _bookEntityFixture.CreateBook();
|
||||
|
||||
// Act
|
||||
ErrorOr<Book> result = bookEntity.ToDomainEntity();
|
||||
Result<Book> result = bookEntity.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(bookEntity.Id, result.Value.Id.Value);
|
||||
Assert.Equal(bookEntity.Title, result.Value.Metadata.Title);
|
||||
@@ -325,12 +325,12 @@ public class BookEntityMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<Book>> results = bookEntities.ToDomainEntities();
|
||||
IEnumerable<Result<Book>> results = bookEntities.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(bookEntities.Count, results.Count());
|
||||
Assert.All(results, result => Assert.False(result.IsError));
|
||||
Assert.All(results, result => Assert.False(result.IsFailure));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Books;
|
||||
using Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Books.Commands.AddBook.Fixtures;
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
@@ -26,10 +26,10 @@ public class BookMetadataDtoMappingTests
|
||||
BookMetadataDto metadata = CreateBookMetadata("The Fellowship of the Ring", "3");
|
||||
|
||||
// Act
|
||||
ErrorOr<Success> result = book.ApplyMetadata(metadata, "Goodreads", DateTime.UtcNow);
|
||||
Result<Success> result = book.ApplyMetadata(metadata, "Goodreads", DateTime.UtcNow);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal("The Fellowship of the Ring", book.Metadata.Title);
|
||||
Assert.Equal("3", book.GoodreadsId.Value);
|
||||
Assert.Equal("The first part of J.R.R. Tolkien's epic adventure.", book.Metadata.Description.Value);
|
||||
@@ -51,10 +51,10 @@ public class BookMetadataDtoMappingTests
|
||||
};
|
||||
|
||||
// Act
|
||||
ErrorOr<Success> result = book.ApplyMetadata(metadata, "Goodreads", DateTime.UtcNow);
|
||||
Result<Success> result = book.ApplyMetadata(metadata, "Goodreads", DateTime.UtcNow);
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.True(result.IsFailure);
|
||||
Assert.Equal(MetadataStatus.Pending, book.MetadataStatus);
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -1,9 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Common.Fixtures;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -35,10 +35,10 @@ public class BookRatingDtoMappingTests
|
||||
BookRatingDto dto = _bookRatingDtoFixture.CreateComplete();
|
||||
|
||||
// Act
|
||||
ErrorOr<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(dto.Value!.Value, result.Value.Value);
|
||||
Assert.Equal(dto.MaxValue!.Value, result.Value.MaxValue);
|
||||
@@ -67,10 +67,10 @@ public class BookRatingDtoMappingTests
|
||||
BookRatingDto dto = _bookRatingDtoFixture.CreateMinimal();
|
||||
|
||||
// Act
|
||||
ErrorOr<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(dto.Value!.Value, result.Value.Value);
|
||||
Assert.Equal(dto.MaxValue!.Value, result.Value.MaxValue);
|
||||
@@ -85,10 +85,10 @@ public class BookRatingDtoMappingTests
|
||||
BookRatingDto dto = _bookRatingDtoFixture.CreateInvalid();
|
||||
|
||||
// Act
|
||||
ErrorOr<BookRating> result = dto.ToDomainEntity();
|
||||
Result<BookRating> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,15 +102,15 @@ public class BookRatingDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<BookRating>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(dtos.Count, results.Count());
|
||||
|
||||
List<ErrorOr<BookRating>> resultList = results.ToList();
|
||||
foreach (ErrorOr<BookRating> result in resultList)
|
||||
Assert.False(result.IsError);
|
||||
List<Result<BookRating>> resultList = [.. results];
|
||||
foreach (Result<BookRating> result in resultList)
|
||||
Assert.False(result.IsFailure);
|
||||
|
||||
// complete rating
|
||||
Assert.Equal(dtos[0].Value!.Value, resultList[0].Value.Value);
|
||||
@@ -137,16 +137,16 @@ public class BookRatingDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<BookRating>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = dtos.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(dtos.Count, results.Count());
|
||||
|
||||
List<ErrorOr<BookRating>> resultList = results.ToList();
|
||||
List<Result<BookRating>> resultList = [.. results];
|
||||
|
||||
Assert.False(resultList[0].IsError);
|
||||
Assert.True(resultList[1].IsError);
|
||||
Assert.False(resultList[2].IsError);
|
||||
Assert.False(resultList[0].IsFailure);
|
||||
Assert.True(resultList[1].IsFailure);
|
||||
Assert.False(resultList[2].IsFailure);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Common.Fixtures;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -95,10 +95,10 @@ public class BookRatingEntityMappingTests
|
||||
BookRatingEntity entity = _fixture.CreateBookRating();
|
||||
|
||||
// Act
|
||||
ErrorOr<BookRating> result = entity.ToDomainEntity();
|
||||
Result<BookRating> result = entity.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(entity.Value, result.Value.Value);
|
||||
Assert.Equal(entity.MaxValue, result.Value.MaxValue);
|
||||
@@ -113,10 +113,10 @@ public class BookRatingEntityMappingTests
|
||||
BookRatingEntity entity = _fixture.CreateInvalidBookRating();
|
||||
|
||||
// Act
|
||||
ErrorOr<BookRating> result = entity.ToDomainEntity();
|
||||
Result<BookRating> result = entity.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(default, result.Value.Value);
|
||||
Assert.Equal(default, result.Value.MaxValue);
|
||||
@@ -135,14 +135,14 @@ public class BookRatingEntityMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<BookRating>> results = entities.ToDomainEntities();
|
||||
IEnumerable<Result<BookRating>> results = entities.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(entities.Count, results.Count());
|
||||
foreach (ErrorOr<BookRating> result in results)
|
||||
foreach (Result<BookRating> result in results)
|
||||
{
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.InRange(result.Value.Value, 1, 5);
|
||||
Assert.Equal(5, result.Value.MaxValue);
|
||||
|
||||
+18
-18
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Application.UnitTests.Core.MediaLibrary.WrittenContentLibrary.BooksLibrary.Common.Fixtures;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -36,10 +36,10 @@ public class IsbnDtoMappingTests
|
||||
IsbnDto dto = _isbnDtoFixture.CreateIsbn10();
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(dto.Value, result.Value.Value);
|
||||
Assert.Equal(dto.Format!.Value, result.Value.Format);
|
||||
@@ -52,10 +52,10 @@ public class IsbnDtoMappingTests
|
||||
IsbnDto dto = _isbnDtoFixture.CreateIsbn13();
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(dto.Value, result.Value.Value);
|
||||
Assert.Equal(dto.Format!.Value, result.Value.Format);
|
||||
@@ -68,10 +68,10 @@ public class IsbnDtoMappingTests
|
||||
IsbnDto dto = _isbnDtoFixture.CreateWithoutFormat();
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(dto.Value, result.Value.Value);
|
||||
Assert.Equal(IsbnFormat.Isbn13, result.Value.Format); // default format
|
||||
@@ -84,10 +84,10 @@ public class IsbnDtoMappingTests
|
||||
IsbnDto dto = _isbnDtoFixture.CreateInvalid();
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = dto.ToDomainEntity();
|
||||
Result<Isbn> result = dto.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,14 +102,14 @@ public class IsbnDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<Isbn>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(dtos.Count, results.Count());
|
||||
|
||||
List<ErrorOr<Isbn>> resultList = results.ToList();
|
||||
Assert.All(resultList, result => Assert.False(result.IsError));
|
||||
List<Result<Isbn>> resultList = [.. results];
|
||||
Assert.All(resultList, result => Assert.False(result.IsFailure));
|
||||
|
||||
Assert.Equal(dtos[0].Value, resultList[0].Value.Value);
|
||||
Assert.Equal(dtos[0].Format!.Value, resultList[0].Value.Format);
|
||||
@@ -133,20 +133,20 @@ public class IsbnDtoMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<Isbn>> results = dtos.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = dtos.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(dtos.Count, results.Count());
|
||||
|
||||
List<ErrorOr<Isbn>> resultList = results.ToList();
|
||||
List<Result<Isbn>> resultList = [.. results];
|
||||
|
||||
Assert.False(resultList[0].IsError);
|
||||
Assert.False(resultList[0].IsFailure);
|
||||
Assert.Equal(dtos[0].Value, resultList[0].Value.Value);
|
||||
|
||||
Assert.True(resultList[1].IsError);
|
||||
Assert.True(resultList[1].IsFailure);
|
||||
|
||||
Assert.False(resultList[2].IsError);
|
||||
Assert.False(resultList[2].IsFailure);
|
||||
Assert.Equal(dtos[2].Value, resultList[2].Value.Value);
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Application.Common.Mapping.Common.Metadata;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.WrittenContentLibrary.BookLibrary.Common;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -75,10 +75,10 @@ public class IsbnEntityMappingTests
|
||||
IsbnEntity entity = new("0-7475-3269-9", IsbnFormat.Isbn10);
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = entity.ToDomainEntity();
|
||||
Result<Isbn> result = entity.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsError);
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.NotNull(result.Value);
|
||||
Assert.Equal(entity.Value, result.Value.Value);
|
||||
Assert.Equal(entity.Format, result.Value.Format);
|
||||
@@ -94,10 +94,10 @@ public class IsbnEntityMappingTests
|
||||
IsbnEntity entity = new(invalidValue, null);
|
||||
|
||||
// Act
|
||||
ErrorOr<Isbn> result = entity.ToDomainEntity();
|
||||
Result<Isbn> result = entity.ToDomainEntity();
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.True(result.IsFailure);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -111,16 +111,16 @@ public class IsbnEntityMappingTests
|
||||
];
|
||||
|
||||
// Act
|
||||
IEnumerable<ErrorOr<Isbn>> results = entities.ToDomainEntities();
|
||||
IEnumerable<Result<Isbn>> results = entities.ToDomainEntities();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(entities.Count, results.Count());
|
||||
|
||||
List<ErrorOr<Isbn>> resultList = results.ToList();
|
||||
List<Result<Isbn>> resultList = [.. results];
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
Assert.False(resultList[i].IsError);
|
||||
Assert.False(resultList[i].IsFailure);
|
||||
Assert.Equal(entities[i].Value, resultList[i].Value.Value);
|
||||
Assert.Equal(entities[i].Format, resultList[i].Value.Format);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class IsbnEntityMappingTests
|
||||
Assert.NotNull(results);
|
||||
Assert.Equal(entities.Count, results.Count());
|
||||
|
||||
List<IsbnDto> resultList = results.ToList();
|
||||
List<IsbnDto> resultList = [.. results];
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
Assert.Equal(entities[i].Value, resultList[i].Value);
|
||||
|
||||
Reference in new issue
Block a user