From a9a3f6bf028993eacbcd3ff95f3a2c0e6867a43e Mon Sep 17 00:00:00 2001 From: Joe Rogers <1337joe@gmail.com> Date: Tue, 22 Feb 2022 15:13:44 +0100 Subject: [PATCH] Split match/rejected tests, add wider sampling of extensions --- .../ExternalFiles/ExternalPathParserTests.cs | 67 +++++++++++-------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/tests/Jellyfin.Naming.Tests/ExternalFiles/ExternalPathParserTests.cs b/tests/Jellyfin.Naming.Tests/ExternalFiles/ExternalPathParserTests.cs index 7bc97aa081..b396b54400 100644 --- a/tests/Jellyfin.Naming.Tests/ExternalFiles/ExternalPathParserTests.cs +++ b/tests/Jellyfin.Naming.Tests/ExternalFiles/ExternalPathParserTests.cs @@ -29,41 +29,54 @@ public class ExternalPathParserTests } [Theory] - [InlineData("", false)] - [InlineData("MyVideo.srt", false)] - [InlineData("MyVideo.mka", true)] - public void ParseFile_AudioFile_ReturnsPathWhenAudio(string path, bool valid) + [InlineData("")] + [InlineData("MyVideo.ass")] + [InlineData("MyVideo.mks")] + [InlineData("MyVideo.sami")] + [InlineData("MyVideo.srt")] + [InlineData("MyVideo.m4v")] + public void ParseFile_AudioExtensionsNotMatched_ReturnsNull(string path) + { + Assert.Null(_audioPathParser.ParseFile(path, string.Empty)); + } + + [Theory] + [InlineData("MyVideo.aa")] + [InlineData("MyVideo.aac")] + [InlineData("MyVideo.flac")] + [InlineData("MyVideo.m4a")] + [InlineData("MyVideo.mka")] + [InlineData("MyVideo.mp3")] + public void ParseFile_AudioExtensionsMatched_ReturnsPath(string path) { var actual = _audioPathParser.ParseFile(path, string.Empty); + Assert.NotNull(actual); + Assert.Equal(path, actual!.Path); + } - if (valid) - { - Assert.NotNull(actual); - Assert.Equal(path, actual!.Path); - } - else - { - Assert.Null(actual); - } + [Theory] + [InlineData("")] + [InlineData("MyVideo.aa")] + [InlineData("MyVideo.aac")] + [InlineData("MyVideo.flac")] + [InlineData("MyVideo.mka")] + [InlineData("MyVideo.m4v")] + public void ParseFile_SubtitleExtensionsNotMatched_ReturnsNull(string path) + { + Assert.Null(_subtitlePathParser.ParseFile(path, string.Empty)); } [Theory] - [InlineData("", false)] - [InlineData("MyVideo.srt", true)] - [InlineData("MyVideo.mka", false)] - public void ParseFile_SubtitleFile_ReturnsPathWhenSubtitle(string path, bool valid) + [InlineData("MyVideo.ass")] + [InlineData("MyVideo.mks")] + [InlineData("MyVideo.sami")] + [InlineData("MyVideo.srt")] + [InlineData("MyVideo.vtt")] + public void ParseFile_SubtitleExtensionsMatched_ReturnsPath(string path) { var actual = _subtitlePathParser.ParseFile(path, string.Empty); - - if (valid) - { - Assert.NotNull(actual); - Assert.Equal(path, actual!.Path); - } - else - { - Assert.Null(actual); - } + Assert.NotNull(actual); + Assert.Equal(path, actual!.Path); } [Theory]