Adds AddBook unit tests

This commit is contained in:
BinaryAlley committed 2024-09-01 14:51:41 +03:00
1 parent bd2880457c
commit a3e956a165
12 files changed
+2579 -13

No files matched your search

@@ -60,7 +60,7 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
if (request.Series != null)
{
// TODO: add logic to search the book series repository for existing book series, based on the provided title
// TODO: uncomment integration tests about series
// TODO: uncomment integration and unit tests about series
}
var domainRatingsResult = request.Ratings.ConvertAll(rating => BookRating.Create(
rating.Value ?? default,
@@ -86,7 +86,6 @@ public class AddBookCommandHandler : IRequestHandler<AddBookCommand, ErrorOr<Boo
return errors;
List<Tag> domainTags = domainTagsResult.Select(tag => tag.Value).ToList();
var domainIsbnsResult = request.ISBNs.ConvertAll(isbn => Isbn.Create(isbn.Value!, (IsbnFormat)(int)isbn.Format!));
errors = domainIsbnsResult.Where(isbnResult => isbnResult.IsError).SelectMany(isbnResult => isbnResult.Errors).ToList();
if (errors.Count != 0)