Added basic parsing and unit tests. Setting up an intermediate object to hold information from parser. Removed hangfire db from git.
This commit is contained in:
parent
4fd9943b91
commit
8c80ed090d
13 changed files with 347 additions and 8 deletions
26
API.Tests/API.Tests.csproj
Normal file
26
API.Tests/API.Tests.csproj
Normal file
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="1.3.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\API\API.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
82
API.Tests/ParserTest.cs
Normal file
82
API.Tests/ParserTest.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
using Xunit;
|
||||
using static API.Parser.Parser;
|
||||
|
||||
namespace API.Tests
|
||||
{
|
||||
public class ParserTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Killing Bites Vol. 0001 Ch. 0001 - Galactica Scanlations (gb)", "1")]
|
||||
[InlineData("My Girlfriend Is Shobitch v01 - ch. 09 - pg. 008.png", "1")]
|
||||
[InlineData("Historys Strongest Disciple Kenichi_v11_c90-98.zip", "11")]
|
||||
[InlineData("B_Gata_H_Kei_v01[SlowManga&OverloadScans]", "1")]
|
||||
[InlineData("BTOOOM! v01 (2013) (Digital) (Shadowcat-Empire)", "1")]
|
||||
[InlineData("Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA]", "1")]
|
||||
[InlineData("Dance in the Vampire Bund v16-17 (Digital) (NiceDragon)", "16-17")]
|
||||
[InlineData("v001", "1")]
|
||||
public void ParseVolumeTest(string filename, string expected)
|
||||
{
|
||||
var result = ParseVolume(filename);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Killing Bites Vol. 0001 Ch. 0001 - Galactica Scanlations (gb)", "Killing Bites")]
|
||||
[InlineData("My Girlfriend Is Shobitch v01 - ch. 09 - pg. 008.png", "My Girlfriend Is Shobitch")]
|
||||
[InlineData("Historys Strongest Disciple Kenichi_v11_c90-98.zip", "Historys Strongest Disciple Kenichi")]
|
||||
[InlineData("B_Gata_H_Kei_v01[SlowManga&OverloadScans]", "B Gata H Kei")]
|
||||
[InlineData("BTOOOM! v01 (2013) (Digital) (Shadowcat-Empire)", "BTOOOM!")]
|
||||
[InlineData("Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA]", "Gokukoku no Brynhildr")]
|
||||
[InlineData("Dance in the Vampire Bund v16-17 (Digital) (NiceDragon)", "Dance in the Vampire Bund")]
|
||||
[InlineData("v001", "")]
|
||||
public void ParseSeriesTest(string filename, string expected)
|
||||
{
|
||||
var result = ParseSeries(filename);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Killing Bites Vol. 0001 Ch. 0001 - Galactica Scanlations (gb)", "1")]
|
||||
[InlineData("My Girlfriend Is Shobitch v01 - ch. 09 - pg. 008.png", "9")]
|
||||
[InlineData("Historys Strongest Disciple Kenichi_v11_c90-98.zip", "90-98")]
|
||||
[InlineData("B_Gata_H_Kei_v01[SlowManga&OverloadScans]", "")]
|
||||
[InlineData("BTOOOM! v01 (2013) (Digital) (Shadowcat-Empire)", "")]
|
||||
[InlineData("Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA]", "1-8")]
|
||||
[InlineData("Dance in the Vampire Bund v16-17 (Digital) (NiceDragon)", "")]
|
||||
[InlineData("c001", "1")]
|
||||
public void ParseChaptersTest(string filename, string expected)
|
||||
{
|
||||
var result = ParseChapter(filename);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData("0001", "1")]
|
||||
[InlineData("1", "1")]
|
||||
[InlineData("0013", "13")]
|
||||
public void RemoveLeadingZeroesTest(string input, string expected)
|
||||
{
|
||||
Assert.Equal(expected, RemoveLeadingZeroes(input));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("1", "001")]
|
||||
[InlineData("10", "010")]
|
||||
[InlineData("100", "100")]
|
||||
public void PadZerosTest(string input, string expected)
|
||||
{
|
||||
Assert.Equal(expected, PadZeros(input));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Hello_I_am_here", "Hello I am here")]
|
||||
[InlineData("Hello_I_am_here ", "Hello I am here")]
|
||||
[InlineData("[ReleaseGroup] The Title", "The Title")]
|
||||
[InlineData("[ReleaseGroup]_The_Title", "The Title")]
|
||||
public void CleanTitleTest(string input, string expected)
|
||||
{
|
||||
Assert.Equal(expected, CleanTitle(input));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue