diff options
| author | Narfinger <narfinger@noreply.github.com> | 2019-10-11 11:46:51 +0900 |
|---|---|---|
| committer | Narfinger <narfinger@noreply.github.com> | 2019-10-11 11:46:51 +0900 |
| commit | 45f906c5564d8ecbc3d6d1cabcd78e929a9fb7e1 (patch) | |
| tree | c509c078588bf6ebe174be68988f53393d4f51f2 | |
| parent | 8da012c8c507b6a177cfff233cfdac3490f79847 (diff) | |
added a couple more tests
| -rw-r--r-- | tests/Jellyfin.Naming.Tests/EpisodePathParserTest.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/Jellyfin.Naming.Tests/EpisodePathParserTest.cs b/tests/Jellyfin.Naming.Tests/EpisodePathParserTest.cs index 596bb3253..c4e1ff354 100644 --- a/tests/Jellyfin.Naming.Tests/EpisodePathParserTest.cs +++ b/tests/Jellyfin.Naming.Tests/EpisodePathParserTest.cs @@ -9,7 +9,7 @@ namespace Emby.Naming.TV [InlineData("/media/Foo/Foo-S01E01", "Foo", 1, 1)] [InlineData("/media/Foo - S04E011", "Foo", 4, 11)] [InlineData("/media/Foo/Foo s01x01", "Foo", 1, 1)] - [InlineData("/media/Foo/Foo s01x03 - the bar of foo", "Foo", 1, 3)] + [InlineData("/media/Foo (2019)/Season 4/Foo (2019).S04E03", "Foo (2019)", 4, 3)] public void ParseEpisodesCorrectly(string path, string name, int season, int episode) { NamingOptions o = new NamingOptions(); @@ -20,6 +20,34 @@ namespace Emby.Naming.TV Assert.Equal(name, res.SeriesName); Assert.Equal(season, res.SeasonNumber); Assert.Equal(episode, res.EpisodeNumber); + + //testing other paths delimeter + var res2 = p.Parse(path.Replace("/", "\\"), false); + Assert.True(res2.Success); + Assert.Equal(name, res2.SeriesName); + Assert.Equal(season, res2.SeasonNumber); + Assert.Equal(episode, res2.EpisodeNumber); + } + + [Theory] + [InlineData("/media/Foo/Foo 889.avi", "Foo", 889)] + public void ParseEpisodeWithoutSeason(string path, string name, int episode) + { + NamingOptions o = new NamingOptions(); + EpisodePathParser p = new EpisodePathParser(o); + var res = p.Parse(path, false, null, null, true); + + Assert.True(res.Success); + Assert.Equal(name, res.SeriesName); + Assert.True(res.SeasonNumber == null); + Assert.Equal(episode, res.EpisodeNumber); + + //testing other paths delimeter + var res2 = p.Parse(path.Replace("/", "\\"), false, null, null, true); + Assert.True(res2.Success); + Assert.Equal(name, res2.SeriesName); + Assert.True(res2.SeasonNumber == null); + Assert.Equal(episode, res2.EpisodeNumber); } } }
\ No newline at end of file |
