mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Adapts the tests and fixtures to the refactored domain and persistence layers
This commit is contained in:
1 parent
e6f0c63feb
commit
ef913f5c9e
99 files changed
+612
-171
No files matched your search
+10
-8
@@ -59,7 +59,8 @@ public class LibraryTests
|
||||
Assert.Equal(title, result.Value.Title);
|
||||
Assert.Equal(libraryType, result.Value.LibraryType);
|
||||
Assert.Equal(2, result.Value.ContentLocations.Count);
|
||||
Assert.Equal(coverImageSourcePath, result.Value.CoverImage);
|
||||
Assert.True(result.Value.CoverImage.HasValue);
|
||||
Assert.Equal(coverImageSourcePath, result.Value.CoverImage.Value);
|
||||
Assert.False(result.Value.IsEnabled);
|
||||
Assert.True(result.Value.IsLocked);
|
||||
Assert.False(result.Value.CanDownloadMetadataFromWeb);
|
||||
@@ -82,7 +83,7 @@ public class LibraryTests
|
||||
"My Library",
|
||||
LibraryType.Movie,
|
||||
["C:/Media"],
|
||||
null,
|
||||
Optional<string>.None(),
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
@@ -108,7 +109,7 @@ public class LibraryTests
|
||||
"My Library",
|
||||
LibraryType.Book,
|
||||
[""],
|
||||
null,
|
||||
Optional<string>.None(),
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
@@ -128,10 +129,10 @@ public class LibraryTests
|
||||
Library library = _libraryFixture.Create();
|
||||
|
||||
// Act
|
||||
string? coverImageSourcePath = library.CoverImageSourcePath;
|
||||
Optional<string> coverImageSourcePath = library.CoverImageSourcePath;
|
||||
|
||||
// Assert
|
||||
Assert.Null(coverImageSourcePath);
|
||||
Assert.False(coverImageSourcePath.HasValue);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -143,7 +144,7 @@ public class LibraryTests
|
||||
"My Library",
|
||||
LibraryType.Book,
|
||||
["C:/Media/Books", "D:/Books"],
|
||||
null,
|
||||
Optional<string>.None(),
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
@@ -170,7 +171,7 @@ public class LibraryTests
|
||||
"My Library",
|
||||
LibraryType.Book,
|
||||
[contentLocation!],
|
||||
null,
|
||||
Optional<string>.None(),
|
||||
isEnabled: true,
|
||||
isLocked: false,
|
||||
canDownloadMetadataFromWeb: true,
|
||||
@@ -260,6 +261,7 @@ public class LibraryTests
|
||||
library.SetInternalLibraryCoverImagePath(internalPath);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(internalPath, library.CoverImage);
|
||||
Assert.True(library.CoverImage.HasValue);
|
||||
Assert.Equal(internalPath, library.CoverImage.Value);
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -45,18 +45,19 @@ public class LibraryScanFailedDomainEventTests
|
||||
Assert.Equal(libraryId, domainEvent.LibraryId);
|
||||
Assert.Equal(compositeId, domainEvent.MediaLibraryScanCompositeId);
|
||||
Assert.Equal(occurredOnUtc, domainEvent.OccurredOnUtc);
|
||||
Assert.Equal(errorMessage, domainEvent.ErrorMessage);
|
||||
Assert.True(domainEvent.ErrorMessage.HasValue);
|
||||
Assert.Equal(errorMessage, domainEvent.ErrorMessage.Value);
|
||||
Assert.IsType<IDomainEvent>(domainEvent, exactMatch: false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithoutErrorMessage_ShouldDefaultErrorMessageToNull()
|
||||
public void Constructor_WhenCalledWithoutErrorMessage_ShouldLeaveErrorMessageUnset()
|
||||
{
|
||||
// Act
|
||||
LibraryScanFailedDomainEvent domainEvent = _libraryScanFailedDomainEventFixture.Create(includeErrorMessage: false);
|
||||
|
||||
// Assert
|
||||
Assert.Null(domainEvent.ErrorMessage);
|
||||
Assert.False(domainEvent.ErrorMessage.HasValue);
|
||||
Assert.IsType<IDomainEvent>(domainEvent, exactMatch: false);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -136,7 +136,7 @@ public class BookTests
|
||||
Assert.Equal(sourceBook.Path, book.Path);
|
||||
Assert.Equal(sourceBook.Metadata, book.Metadata);
|
||||
Assert.Equal(createdOnUtc, book.CreatedOnUtc);
|
||||
Assert.Equal(updatedOnUtc, book.UpdatedOnUtc);
|
||||
Assert.Equal(Optional<DateTime>.Some(updatedOnUtc), book.UpdatedOnUtc);
|
||||
Assert.Equal(sourceBook.ISBNs, book.ISBNs);
|
||||
Assert.Equal(sourceBook.Ratings, book.Ratings);
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class IsbnTests
|
||||
public void Create_WhenValueIsNullOrWhitespace_ShouldReturnError(string? value)
|
||||
{
|
||||
// Act
|
||||
Result<Isbn> result = Isbn.Create(value, IsbnFormat.Isbn10);
|
||||
Result<Isbn> result = Isbn.Create(value!, IsbnFormat.Isbn10);
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsFailure);
|
||||
|
||||
Reference in new issue
Block a user