Split match/rejected tests, add wider sampling of extensions

This commit is contained in:
Joe Rogers 2022-02-22 15:13:44 +01:00
parent cf033b25f8
commit a9a3f6bf02
No known key found for this signature in database
GPG Key ID: 0074AD57B8FDBBB4

View File

@ -29,41 +29,54 @@ public class ExternalPathParserTests
} }
[Theory] [Theory]
[InlineData("", false)] [InlineData("")]
[InlineData("MyVideo.srt", false)] [InlineData("MyVideo.ass")]
[InlineData("MyVideo.mka", true)] [InlineData("MyVideo.mks")]
public void ParseFile_AudioFile_ReturnsPathWhenAudio(string path, bool valid) [InlineData("MyVideo.sami")]
[InlineData("MyVideo.srt")]
[InlineData("MyVideo.m4v")]
public void ParseFile_AudioExtensionsNotMatched_ReturnsNull(string path)
{ {
var actual = _audioPathParser.ParseFile(path, string.Empty); Assert.Null(_audioPathParser.ParseFile(path, string.Empty));
if (valid)
{
Assert.NotNull(actual);
Assert.Equal(path, actual!.Path);
}
else
{
Assert.Null(actual);
}
} }
[Theory] [Theory]
[InlineData("", false)] [InlineData("MyVideo.aa")]
[InlineData("MyVideo.srt", true)] [InlineData("MyVideo.aac")]
[InlineData("MyVideo.mka", false)] [InlineData("MyVideo.flac")]
public void ParseFile_SubtitleFile_ReturnsPathWhenSubtitle(string path, bool valid) [InlineData("MyVideo.m4a")]
{ [InlineData("MyVideo.mka")]
var actual = _subtitlePathParser.ParseFile(path, string.Empty); [InlineData("MyVideo.mp3")]
public void ParseFile_AudioExtensionsMatched_ReturnsPath(string path)
if (valid)
{ {
var actual = _audioPathParser.ParseFile(path, string.Empty);
Assert.NotNull(actual); Assert.NotNull(actual);
Assert.Equal(path, actual!.Path); Assert.Equal(path, actual!.Path);
} }
else
[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(actual); Assert.Null(_subtitlePathParser.ParseFile(path, string.Empty));
} }
[Theory]
[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);
Assert.NotNull(actual);
Assert.Equal(path, actual!.Path);
} }
[Theory] [Theory]