Foundational Rework (Round 2) (#2767)

This commit is contained in:
Joe Milazzo 2024-03-07 07:13:36 -07:00 committed by GitHub
parent 304fd8bc79
commit fc87dba0a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 249 additions and 84 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using API.Entities.Enums;
@ -33,7 +34,7 @@ public class ParserInfoListExtensions
[Theory]
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06-07) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06-07) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, false)]
[InlineData(new[] {@"Cynthia The Mission v20 c12-20 [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, false)]
public void HasInfoTest(string[] inputInfos, string[] inputChapters, bool expectedHasInfo)
{
@ -41,8 +42,8 @@ public class ParserInfoListExtensions
foreach (var filename in inputInfos)
{
infos.Add(_defaultParser.Parse(
filename,
string.Empty));
Path.Join("E:/Manga/Cynthia the Mission/", filename),
"E:/Manga/"));
}
var files = inputChapters.Select(s => new MangaFileBuilder(s, MangaFormat.Archive, 199).Build()).ToList();
@ -52,4 +53,26 @@ public class ParserInfoListExtensions
Assert.Equal(expectedHasInfo, infos.HasInfo(chapter));
}
[Fact]
public void HasInfoTest_SuccessWhenSpecial()
{
var infos = new[]
{
_defaultParser.Parse(
"E:/Manga/Cynthia the Mission/Cynthia The Mission The Special SP01 [Desudesu&Brolen].zip",
"E:/Manga/")
};
var files = new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission The Special SP01 [Desudesu&Brolen].zip"}
.Select(s => new MangaFileBuilder(s, MangaFormat.Archive, 199).Build())
.ToList();
var chapter = new ChapterBuilder("Cynthia The Mission The Special SP01 [Desudesu&Brolen].zip")
.WithRange("Cynthia The Mission The Special SP01 [Desudesu&Brolen]")
.WithFiles(files)
.WithIsSpecial(true)
.Build();
Assert.True(infos.HasInfo(chapter));
}
}