aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Jellyfin.Naming.Tests/Video/StubTests.cs')
-rw-r--r--tests/Jellyfin.Naming.Tests/Video/StubTests.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/Jellyfin.Naming.Tests/Video/StubTests.cs b/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
new file mode 100644
index 0000000000..96fa8c5a55
--- /dev/null
+++ b/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Globalization;
+using Emby.Naming.Common;
+using Emby.Naming.Video;
+using Xunit;
+
+namespace Jellyfin.Naming.Tests.Video
+{
+ public class StubTests : BaseVideoTest
+ {
+ [Fact]
+ public void TestStubs()
+ {
+ Test("video.mkv", false, null);
+ Test("video.disc", true, null);
+ Test("video.dvd.disc", true, "dvd");
+ Test("video.hddvd.disc", true, "hddvd");
+ Test("video.bluray.disc", true, "bluray");
+ Test("video.brrip.disc", true, "bluray");
+ Test("video.bd25.disc", true, "bluray");
+ Test("video.bd50.disc", true, "bluray");
+ Test("video.vhs.disc", true, "vhs");
+ Test("video.hdtv.disc", true, "tv");
+ Test("video.pdtv.disc", true, "tv");
+ Test("video.dsr.disc", true, "tv");
+ }
+
+ [Fact]
+ public void TestStubName()
+ {
+ var result =
+ GetParser().ResolveFile(@"C:/Users/media/Desktop/Video Test/Movies/Oblivion/Oblivion.dvd.disc");
+
+ Assert.Equal("Oblivion", result.Name);
+ }
+
+ private void Test(string path, bool isStub, string stubType)
+ {
+ var options = new NamingOptions();
+
+ var resultStubType = StubResolver.ResolveFile(path, options);
+
+ Assert.Equal(isStub, resultStubType.IsStub);
+
+ if (stubType == null)
+ {
+ Assert.Null(resultStubType.StubType);
+ }
+ else
+ {
+ Assert.Equal(stubType, resultStubType.StubType, true);
+ }
+ }
+ }
+}