jellyfin-server/tests/Jellyfin.Naming.Tests/TV/SeasonFolderTests.cs

112 lines
2.9 KiB
C#
Raw Normal View History

2019-12-06 19:40:06 +00:00
using Emby.Naming.TV;
using Xunit;
namespace Jellyfin.Naming.Tests.TV
{
public class SeasonFolderTests
{
[Fact]
public void TestGetSeasonNumberFromPath1()
{
Assert.Equal(1, GetSeasonNumberFromPath(@"/Drive/Season 1"));
}
[Fact]
public void TestGetSeasonNumberFromPath2()
{
Assert.Equal(2, GetSeasonNumberFromPath(@"/Drive/Season 2"));
}
[Fact]
public void TestGetSeasonNumberFromPath3()
{
Assert.Equal(2, GetSeasonNumberFromPath(@"/Drive/Season 02"));
}
[Fact]
public void TestGetSeasonNumberFromPath4()
{
Assert.Equal(1, GetSeasonNumberFromPath(@"/Drive/Season 1"));
}
[Fact]
public void TestGetSeasonNumberFromPath5()
{
Assert.Equal(2, GetSeasonNumberFromPath(@"/Drive/Seinfeld/S02"));
}
[Fact]
public void TestGetSeasonNumberFromPath6()
{
Assert.Equal(2, GetSeasonNumberFromPath(@"/Drive/Seinfeld/2"));
}
[Fact]
public void TestGetSeasonNumberFromPath7()
{
Assert.Equal(2009, GetSeasonNumberFromPath(@"/Drive/Season 2009"));
}
[Fact]
public void TestGetSeasonNumberFromPath8()
{
Assert.Equal(1, GetSeasonNumberFromPath(@"/Drive/Season1"));
}
[Fact]
public void TestGetSeasonNumberFromPath9()
{
Assert.Equal(4, GetSeasonNumberFromPath(@"The Wonder Years/The.Wonder.Years.S04.PDTV.x264-JCH"));
}
[Fact]
public void TestGetSeasonNumberFromPath10()
{
Assert.Equal(7, GetSeasonNumberFromPath(@"/Drive/Season 7 (2016)"));
}
[Fact]
public void TestGetSeasonNumberFromPath11()
{
Assert.Equal(7, GetSeasonNumberFromPath(@"/Drive/Staffel 7 (2016)"));
}
[Fact]
public void TestGetSeasonNumberFromPath12()
{
Assert.Equal(7, GetSeasonNumberFromPath(@"/Drive/Stagione 7 (2016)"));
}
[Fact]
public void TestGetSeasonNumberFromPath14()
{
Assert.Null(GetSeasonNumberFromPath(@"/Drive/Season (8)"));
}
[Fact]
public void TestGetSeasonNumberFromPath13()
{
Assert.Equal(3, GetSeasonNumberFromPath(@"/Drive/3.Staffel"));
}
[Fact]
public void TestGetSeasonNumberFromPath15()
{
Assert.Null(GetSeasonNumberFromPath(@"/Drive/s06e05"));
}
[Fact]
public void TestGetSeasonNumberFromPath16()
{
Assert.Null(GetSeasonNumberFromPath(@"/Drive/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv"));
}
private int? GetSeasonNumberFromPath(string path)
{
2020-01-22 21:18:56 +00:00
var result = SeasonPathParser.Parse(path, true, true);
2019-12-06 19:40:06 +00:00
return result.SeasonNumber;
}
}
}