Fallback to other locations when ComicInfo.xml not at root of archive (#1551)

* Fallback to other locations when ComicInfo.xml not at root of archive

* Better ComicInfo test coverage and benchmarks

* Add a rar archive to the ComicInfo test cases
This commit is contained in:
tjarls 2022-09-22 22:44:01 +01:00 committed by GitHub
parent aafbce377b
commit bc1e314326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 17 deletions

View file

@ -256,17 +256,31 @@ public class ArchiveServiceTests
Assert.Equal("Junya Inoue", comicInfo.Writer);
}
[Fact]
public void ShouldHaveComicInfo_TopLevelFileOnly()
[Theory]
[InlineData("ComicInfo_duplicateInfos.zip")]
[InlineData("ComicInfo_duplicateInfos_reversed.zip")]
[InlineData("ComicInfo_duplicateInfos.rar")]
public void ShouldHaveComicInfo_TopLevelFileOnly(string filename)
{
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/ComicInfos");
var archive = Path.Join(testDirectory, "ComicInfo_duplicateInfos.zip");
var archive = Path.Join(testDirectory, filename);
var comicInfo = _archiveService.GetComicInfo(archive);
Assert.NotNull(comicInfo);
Assert.Equal("BTOOOM!", comicInfo.Series);
}
[Fact]
public void ShouldHaveComicInfo_OutsideRoot()
{
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/ComicInfos");
var archive = Path.Join(testDirectory, "ComicInfo_outside_root.zip");
var comicInfo = _archiveService.GetComicInfo(archive);
Assert.NotNull(comicInfo);
Assert.Equal("BTOOOM! - Duplicate", comicInfo.Series);
}
#endregion
#region CanParseComicInfo