Adds media library advanced options

This commit is contained in:
BinaryAlley committed 2025-01-25 12:27:50 +02:00
1 parent 1c28355197
commit f89ba4960a
60 files changed
+1877 -51

No files matched your search

@@ -23,7 +23,11 @@ public class AddMediaLibraryRequestMappingTests
"My Library",
"Book",
["C:/Books", "D:/Media/Books"],
"D:/poster.jpg"
"D:/poster.jpg",
true,
false,
true,
false
);
// Act
@@ -35,6 +39,10 @@ public class AddMediaLibraryRequestMappingTests
result.LibraryType.Should().Be(request.LibraryType);
result.ContentLocations.Should().BeEquivalentTo(request.ContentLocations);
result.CoverImage.Should().BeEquivalentTo(request.CoverImage);
result.IsEnabled.Should().Be(request.IsEnabled);
result.IsLocked.Should().Be(request.IsLocked);
result.DownloadMedatadaFromWeb.Should().Be(request.DownloadMedatadaFromWeb);
result.SaveMetadataInMediaDirectories.Should().Be(request.SaveMetadataInMediaDirectories);
}
[Theory]
@@ -49,7 +57,11 @@ public class AddMediaLibraryRequestMappingTests
"My Library",
libraryType.ToString(),
["C:/Media"],
"D:/poster.jpg"
"D:/poster.jpg",
true,
false,
true,
false
);
// Act
@@ -61,6 +73,10 @@ public class AddMediaLibraryRequestMappingTests
result.LibraryType.Should().Be(libraryType.ToString());
result.ContentLocations.Should().BeEquivalentTo(request.ContentLocations);
result.CoverImage.Should().BeEquivalentTo(request.CoverImage);
result.IsEnabled.Should().Be(request.IsEnabled);
result.IsLocked.Should().Be(request.IsLocked);
result.DownloadMedatadaFromWeb.Should().Be(request.DownloadMedatadaFromWeb);
result.SaveMetadataInMediaDirectories.Should().Be(request.SaveMetadataInMediaDirectories);
}
[Fact]
@@ -79,7 +95,11 @@ public class AddMediaLibraryRequestMappingTests
"My Library",
"Book",
contentLocations,
"D:/poster.jpg"
"D:/poster.jpg",
true,
false,
true,
false
);
// Act
@@ -104,7 +124,11 @@ public class AddMediaLibraryRequestMappingTests
"My Library",
"Book",
contentLocations,
null
null,
true,
false,
true,
false
);
// Act
@@ -30,7 +30,11 @@ public class LibraryMappingTests
"Test Library",
LibraryType.Book,
["C:/Books", "D:/Media/Books"],
"D:/myPoster.jpg"
"D:/myPoster.jpg",
true,
false,
true,
false
);
Library library = libraryResult.Value;
@@ -48,6 +52,10 @@ public class LibraryMappingTests
result.CoverImage.Should().BeEquivalentTo(library.CoverImage);
result.CreatedOnUtc.Should().Be(library.CreatedOnUtc);
result.UpdatedOnUtc.Should().Be(library.UpdatedOnUtc.HasValue ? library.UpdatedOnUtc : null);
result.IsEnabled.Should().BeTrue();
result.IsLocked.Should().BeFalse();
result.DownloadMedatadaFromWeb.Should().BeTrue();
result.SaveMetadataInMediaDirectories.Should().BeFalse();
}
[Fact]
@@ -59,7 +67,11 @@ public class LibraryMappingTests
"Empty Library",
LibraryType.Book,
[],
"D:/myPoster.jpg"
"D:/myPoster.jpg",
true,
false,
true,
false
);
Library library = libraryResult.Value;
@@ -85,7 +97,11 @@ public class LibraryMappingTests
"Test Library",
libraryType,
["C:/Media"],
"D:/myPoster.jpg"
"D:/myPoster.jpg",
true,
false,
true,
false
);
Library library = libraryResult.Value;
@@ -96,6 +112,10 @@ public class LibraryMappingTests
result.Should().NotBeNull();
result.LibraryType.Should().Be(libraryType);
result.CoverImage.Should().BeEquivalentTo(library.CoverImage);
result.IsEnabled.Should().BeTrue();
result.IsLocked.Should().BeFalse();
result.DownloadMedatadaFromWeb.Should().BeTrue();
result.SaveMetadataInMediaDirectories.Should().BeFalse();
}
[Fact]
@@ -115,7 +135,11 @@ public class LibraryMappingTests
"Test Library",
LibraryType.Book,
contentLocations,
"D:/myPoster.jpg"
"D:/myPoster.jpg",
true,
false,
true,
false
);
Library library = libraryResult.Value;
@@ -144,7 +168,11 @@ public class LibraryMappingTests
"Test Library",
LibraryType.Book,
contentLocations,
null
null,
true,
false,
true,
false
);
Library library = libraryResult.Value;
@@ -48,7 +48,11 @@ public class DomainLibraryFixture
_faker.Random.String2(_faker.Random.Number(1, 50)),
_faker.PickRandom<LibraryType>(),
validPaths.Take(_random.Next(1, validPaths.Count)),
_faker.System.FilePath()
_faker.System.FilePath(),
_faker.Random.Bool(),
_faker.Random.Bool(),
_faker.Random.Bool(),
_faker.Random.Bool()
);
return library.Value;
@@ -60,7 +64,11 @@ public class DomainLibraryFixture
string? title = null,
LibraryType? libraryType = null,
IEnumerable<string>? contentLocations = null,
string? coverImage = null)
string? coverImage = null,
bool isEnabled = true,
bool isLocked = false,
bool downloadMedatadaFromWeb = true,
bool saveMetadataInMediaDirectories = false)
{
ErrorOr<Library> library = id is null ?
Library.Create(
@@ -68,7 +76,11 @@ public class DomainLibraryFixture
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? LibraryType.Book,
contentLocations ?? ["C:/Media"],
coverImage
coverImage,
isEnabled,
isLocked,
downloadMedatadaFromWeb,
saveMetadataInMediaDirectories
) :
Library.Create(
LibraryId.Create(id.Value),
@@ -76,7 +88,11 @@ public class DomainLibraryFixture
title ?? _faker.Random.String2(_faker.Random.Number(1, 50)),
libraryType ?? LibraryType.Book,
contentLocations ?? ["C:/Media"],
coverImage
coverImage,
isEnabled,
isLocked,
downloadMedatadaFromWeb,
saveMetadataInMediaDirectories
);
return library.Value;