aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtparr <dtparr@users.noreply.github.com>2020-04-10 21:18:41 +0000
committerdtparr <dtparr@users.noreply.github.com>2020-04-10 21:18:41 +0000
commitce86455747f73b45d2fec5e507573d2368e498f5 (patch)
treeff5fce4a45ddeec1e81ebdf094e6b9ab6a8a1012
parent1f33c519779bd197c9d0d6ff2373cebf3a5dd3d9 (diff)
Update to use the Theory/InlineData method to parameterize unit tests
-rw-r--r--tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs59
1 files changed, 25 insertions, 34 deletions
diff --git a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
index c2a9ef2da..6dc5792e2 100644
--- a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
@@ -45,44 +45,35 @@ namespace Jellyfin.Naming.Tests.Video
Test("300-behindthescenes.mp4", ExtraType.BehindTheScenes, videoOptions);
}
- [Fact]
- public void TestDirectories()
+ [Theory]
+ [InlineData(ExtraType.BehindTheScenes, "behind the scenes" )]
+ [InlineData(ExtraType.DeletedScene, "deleted scenes" )]
+ [InlineData(ExtraType.Interview, "interviews" )]
+ [InlineData(ExtraType.Scene, "scenes" )]
+ [InlineData(ExtraType.Sample, "samples" )]
+ [InlineData(ExtraType.Clip, "shorts" )]
+ [InlineData(ExtraType.Clip, "featurettes" )]
+ [InlineData(ExtraType.Unknown, "extras" )]
+ public void TestDirectories(ExtraType type, string dirName)
{
var videoOptions = new NamingOptions();
- (ExtraType Type, string dirName)[] extraDirectoryNameTests =
- {
- (ExtraType.BehindTheScenes, "behind the scenes" ),
- (ExtraType.DeletedScene, "deleted scenes" ),
- (ExtraType.Interview, "interviews" ),
- (ExtraType.Scene, "scenes" ),
- (ExtraType.Sample, "samples" ),
- (ExtraType.Clip, "shorts" ),
- (ExtraType.Clip, "featurettes" ),
- (ExtraType.Unknown, "extras" ),
- };
-
- foreach ((ExtraType type, string dirName) in extraDirectoryNameTests)
- {
- Test(dirName + "/300.mp4", type, videoOptions);
- Test("300/" + dirName + "/something.mkv", type, videoOptions);
- Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", type, videoOptions);
- }
+ Test(dirName + "/300.mp4", type, videoOptions);
+ Test("300/" + dirName + "/something.mkv", type, videoOptions);
+ Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", type, videoOptions);
+ }
- //Test the null condition
- string[] nonExtraDirectoryNames =
- {
- "gibberish",
- "not a scene",
- };
- foreach (string dirName in nonExtraDirectoryNames)
- {
- Test(dirName + "/300.mp4", null, videoOptions);
- Test("300/" + dirName + "/something.mkv", null, videoOptions);
- Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", null, videoOptions);
- }
- Test("/data/something/Movies/not a scene/not a scene.mp4", null, videoOptions);
- Test("/data/something/Movies/The Big Short/The Big Short.mp4", null, videoOptions);
+ [Theory]
+ [InlineData("gibberish")]
+ [InlineData("not a scene")]
+ [InlineData("The Big Short")]
+ public void TestNonExtraDirectories(string dirName)
+ {
+ var videoOptions = new NamingOptions();
+ Test(dirName + "/300.mp4", null, videoOptions);
+ Test("300/" + dirName + "/something.mkv", null, videoOptions);
+ Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", null, videoOptions);
+ Test("/data/something/Movies/" + dirName + "/" + dirName + ".mp4", null, videoOptions);
}
[Fact]